fix: persist rust binary from cache mount for COPY command

The rust binary built with a cache mount wasn't available for COPY
because cache mounts are ephemeral. Copy the binary to a persistent
location within the same RUN command while the mount is accessible.
This commit is contained in:
2026-03-17 22:17:03 -04:00
parent ea130d3299
commit f8426c4dde

View File

@@ -11,7 +11,9 @@ WORKDIR /app
COPY rust ./rust
RUN --mount=type=cache,target=/usr/local/cargo/registry \
--mount=type=cache,target=/app/rust/target \
cargo build --manifest-path rust/Cargo.toml --release --bin fiscal-xbrl
cargo build --manifest-path rust/Cargo.toml --release --bin fiscal-xbrl \
&& mkdir -p /app/bin \
&& cp /app/rust/target/release/fiscal-xbrl /app/bin/fiscal-xbrl
FROM deps AS builder
ARG NEXT_PUBLIC_API_URL=
@@ -51,7 +53,7 @@ COPY --from=builder /app/tsconfig.json ./tsconfig.json
COPY --from=deps /app/node_modules ./node_modules
COPY --from=deps /app/package.json ./package.json
COPY --from=deps /app/bun.lock ./bun.lock
COPY --from=rust-builder /app/rust/target/release/fiscal-xbrl ./bin/fiscal-xbrl
COPY --from=rust-builder /app/bin/fiscal-xbrl ./bin/fiscal-xbrl
RUN mkdir -p /app/data /app/.workflow-data /app/bin /app/.cache/xbrl && chmod +x /app/bin/fiscal-xbrl