The app image failed to build ("cannot copy from stage edge-build, it needs to be defined before current stage app").
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
46 lines
1.8 KiB
Docker
46 lines
1.8 KiB
Docker
# syntax=docker/dockerfile:1
|
|
#
|
|
# Voyager 2's images (deploy/compose.yaml):
|
|
# --target app the AdonisJS app: web server, coordinator, migrations, ace commands
|
|
# --target edge the Rust edge worker (edge/, bin edge-node)
|
|
|
|
# Node is pinned as in CI (.nvmrc): on 24.21, jsonschema 1.5.0 (used by Ace to
|
|
# validate commands) throws "Invalid URL" on $ref, so no ace command starts.
|
|
ARG NODE_VERSION=24.16
|
|
|
|
# The Rust worker (before the app: its image carries edge-bench). Registry and target dir are build caches, so a rebuild only compiles what changed.
|
|
FROM rust:1-bookworm AS edge-build
|
|
WORKDIR /src
|
|
COPY edge ./
|
|
RUN --mount=type=cache,target=/usr/local/cargo/registry \
|
|
--mount=type=cache,target=/src/target \
|
|
cargo build --release --locked --bin edge-node --bin edge-bench \
|
|
&& cp target/release/edge-node target/release/edge-bench /usr/local/bin/
|
|
|
|
# The app, compiled, with production dependencies only.
|
|
FROM node:${NODE_VERSION}-bookworm AS app-build
|
|
WORKDIR /src
|
|
COPY package.json package-lock.json ./
|
|
RUN npm ci
|
|
COPY . .
|
|
RUN node ace build \
|
|
&& cd build \
|
|
&& npm ci --omit=dev
|
|
|
|
FROM node:${NODE_VERSION}-bookworm-slim AS app
|
|
ENV NODE_ENV=production
|
|
WORKDIR /app
|
|
COPY --from=app-build /src/build ./
|
|
# The Rust indexer's bench: `node ace replay:corpus` runs a group's corpus through it (the replay harness).
|
|
COPY --from=edge-build /usr/local/bin/edge-bench /usr/local/bin/edge-bench
|
|
USER node
|
|
# Every service picks its own command, e.g. `node ace coordinator:run`.
|
|
CMD ["node", "ace", "list"]
|
|
|
|
FROM debian:bookworm-slim AS edge
|
|
COPY --from=edge-build /usr/local/bin/edge-node /usr/local/bin/edge-node
|
|
# edge-bench replays the corpus for the grouping sweeps (deploy/corpus_sweep.py).
|
|
COPY --from=edge-build /usr/local/bin/edge-bench /usr/local/bin/edge-bench
|
|
USER 1000:1000
|
|
ENTRYPOINT ["/usr/local/bin/edge-node"]
|