Skip to content

Commit 6a242a0

Browse files
committed
try this
1 parent 0e097aa commit 6a242a0

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

eth2near/Dockerfile

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
# syntax=docker/dockerfile:1
2-
FROM rust:1.84.0-bookworm AS chef
3-
# Install cargo-chef for dependency caching
4-
RUN cargo install cargo-chef
2+
FROM lukemathwalker/cargo-chef:latest-rust-1.84-slim-bookworm AS chef
3+
RUN cargo install --locked sccache
4+
ENV RUSTC_WRAPPER=sccache
5+
ENV SCCACHE_CACHE_SIZE=2G
6+
ENV SCCACHE_DIR=/sccache
57
WORKDIR /app
68

79
FROM chef AS planner
@@ -25,19 +27,24 @@ WORKDIR /app/eth2near
2527
RUN --mount=type=cache,target=/app/eth2near/target \
2628
--mount=type=cache,target=/usr/local/cargo/registry \
2729
--mount=type=cache,target=/usr/local/cargo/git \
30+
--mount=type=cache,target=/sccache,sharing=locked \
2831
cargo chef cook --release --recipe-path recipe.json
2932

3033
# Copy source code and build the actual project
3134
COPY eth2near/ ./
3235

33-
# Build the final binaries - only rebuilds when source changes
36+
# Build with sccache - only rebuilds when source changes
3437
RUN --mount=type=cache,target=/app/eth2near/target \
3538
--mount=type=cache,target=/usr/local/cargo/registry \
3639
--mount=type=cache,target=/usr/local/cargo/git \
40+
--mount=type=cache,target=/sccache,sharing=locked \
3741
cargo build --release && \
3842
cp target/release/eth2-contract-init /tmp/ && \
3943
cp target/release/eth2_to_near_relay /tmp/
4044

45+
# Show sccache stats (optional, for debugging)
46+
RUN sccache --show-stats
47+
4148
# === RUNTIME STAGE ===
4249
FROM debian:bookworm-slim AS runtime
4350

0 commit comments

Comments
 (0)