|
| 1 | +# Copyright (c) 2024 Cloudflare, Inc. All rights reserved. |
| 2 | +# SPDX-License-Identifier: BSD-3-Clause |
| 3 | + |
| 4 | +FROM rust:1.83-bookworm AS builder |
| 5 | +RUN apt update && apt install -y capnproto clang cmake |
| 6 | + |
| 7 | +# Pre-install worker-build and Rust's wasm32 target to speed up our custom build command |
| 8 | +RUN rustup target add wasm32-unknown-unknown |
| 9 | +RUN cargo install --git https://github.com/cloudflare/workers-rs |
| 10 | + |
| 11 | +# Build the storage proxy. |
| 12 | +WORKDIR /tmp/dap_test |
| 13 | +COPY Cargo.toml Cargo.lock ./ |
| 14 | +COPY crates/daphne-worker-test ./crates/daphne-worker-test |
| 15 | +COPY crates/daphne-worker ./crates/daphne-worker |
| 16 | +COPY crates/daphne-service-utils ./crates/daphne-service-utils |
| 17 | +COPY crates/daphne ./crates/daphne |
| 18 | +WORKDIR /tmp/dap_test/crates/daphne-worker-test |
| 19 | +RUN worker-build --dev |
| 20 | + |
| 21 | +FROM node:bookworm AS leader |
| 22 | +RUN npm install -g wrangler@3.60.1 && npm cache clean --force |
| 23 | +COPY --from=builder /tmp/dap_test/crates/daphne-worker-test/build/ /build |
| 24 | +COPY crates/daphne-worker-test/wrangler.aggregator.toml / |
| 25 | +# this container doesn't need worker-build but the wrangler.toml requires it, so we just fake it |
| 26 | +RUN ln -s /usr/bin/true /usr/bin/worker-build |
| 27 | + |
| 28 | +ENTRYPOINT ["wrangler", "dev", "--config", "wrangler.aggregator.toml", "-e", "leader", "--port", "8787"] |
| 29 | + |
| 30 | +FROM node:bookworm AS helper |
| 31 | +RUN npm install -g wrangler@3.60.1 && npm cache clean --force |
| 32 | +COPY --from=builder /tmp/dap_test/crates/daphne-worker-test/build/ /build |
| 33 | +COPY crates/daphne-worker-test/wrangler.aggregator.toml / |
| 34 | +# this container doesn't need worker-build but the wrangler.toml requires it, so we just fake it |
| 35 | +RUN ln -s /usr/bin/true /usr/bin/worker-build |
| 36 | + |
| 37 | +ENTRYPOINT ["wrangler", "dev", "--config", "wrangler.aggregator.toml", "-e", "helper", "--port", "8788"] |
0 commit comments