Skip to content

Commit 0b61073

Browse files
committed
Copy in the same step
1 parent 9df0cc9 commit 0b61073

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

eth2near/Dockerfile

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,14 @@ WORKDIR /app
77
COPY contracts/ ./contracts/
88
COPY eth2near/ ./eth2near/
99

10-
# Build the project with cache mounts
10+
# Build the project and copy binaries out of cache mount
1111
WORKDIR /app/eth2near
12-
ENV CARGO_NET_GIT_FETCH_WITH_CLI=true
1312
RUN --mount=type=cache,target=/app/eth2near/target \
1413
--mount=type=cache,target=/usr/local/cargo/registry \
15-
--mount=type=cache,target=/usr/local/cargo/git,id=git-cache-v2 \
16-
cargo build --release
14+
--mount=type=cache,target=/usr/local/cargo/git \
15+
cargo build --release && \
16+
cp target/release/eth2-contract-init /tmp/ && \
17+
cp target/release/eth2_to_near_relay /tmp/
1718

1819
# === RUNTIME STAGE ===
1920
FROM debian:bookworm-slim AS runtime
@@ -26,9 +27,9 @@ RUN apt-get update && apt-get install -y \
2627

2728
WORKDIR /app
2829

29-
# Copy built binaries from builder stage
30-
COPY --from=builder /app/eth2near/target/release/eth2-contract-init /usr/local/bin/
31-
COPY --from=builder /app/eth2near/target/release/eth2_to_near_relay /usr/local/bin/
30+
# Copy built binaries from temp location
31+
COPY --from=builder /tmp/eth2-contract-init /usr/local/bin/
32+
COPY --from=builder /tmp/eth2_to_near_relay /usr/local/bin/
3233

3334
# Create non-root user for security
3435
RUN useradd -m -u 1001 appuser

0 commit comments

Comments
 (0)