This repository was archived by the owner on Oct 19, 2026. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -74,7 +74,16 @@ COPY saturn ./saturn
7474COPY vault ./vault
7575
7676# Build the mono binary (fixed release)
77- RUN cargo build --release -p mono
77+ #
78+ # NOTE: Build output must be persisted into the image layer for the runtime stage `COPY`.
79+ # A buildkit cache mount is not committed into the layer, so we build into a cached dir
80+ # then copy the final binary into `/opt/mega/target/...` (regular filesystem).
81+ RUN --mount=type=cache,target=/usr/local/cargo/registry \
82+ --mount=type=cache,target=/usr/local/cargo/git \
83+ --mount=type=cache,target=/opt/mega/target-cache \
84+ CARGO_TARGET_DIR=/opt/mega/target-cache cargo build --release -p mono && \
85+ mkdir -p /opt/mega/target/release && \
86+ cp /opt/mega/target-cache/release/mono /opt/mega/target/release/mono
7887
7988
8089# ---------- runtime stage ----------
Original file line number Diff line number Diff line change @@ -44,11 +44,15 @@ RUN --mount=type=cache,target=/usr/local/cargo/registry \
4444COPY . .
4545
4646# -- Step 2: build binary into normal target directory
47- ENV CARGO_TARGET_DIR=/app/target
47+ # NOTE: build output must be persisted into the image layer for the runtime stage `COPY`.
48+ # A buildkit cache mount is not committed into the layer, so we build into a cached dir
49+ # then copy the final binary into `/app/target/...` (regular filesystem).
4850RUN --mount=type=cache,target=/usr/local/cargo/registry \
4951 --mount=type=cache,target=/usr/local/cargo/git \
50- --mount=type=cache,target=/app/target \
51- cargo build -p orion-server --release
52+ --mount=type=cache,target=/app/target-cache \
53+ CARGO_TARGET_DIR=/app/target-cache cargo build -p orion-server --release && \
54+ mkdir -p /app/target/release && \
55+ cp /app/target-cache/release/orion-server /app/target/release/orion-server
5256
5357# ────── Stage 3: Runtime ──────
5458FROM debian:bookworm-slim
You can’t perform that action at this time.
0 commit comments