Skip to content

Commit f87952e

Browse files
authored
chore: simplify docker image for debugging (#304)
1 parent ff4c1d9 commit f87952e

File tree

2 files changed

+24
-16
lines changed

2 files changed

+24
-16
lines changed

crates/xtask/Dockerfile

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,8 @@
11
FROM rust:latest AS base
2-
RUN cargo install sccache --version ^0.7
3-
RUN cargo install cargo-chef --version ^0.1
4-
ENV RUSTC_WRAPPER=sccache SCCACHE_DIR=/sccache
5-
6-
FROM base AS planner
2+
73
WORKDIR /app
4+
85
COPY . .
9-
RUN --mount=type=cache,target=$SCCACHE_DIR,sharing=locked \
10-
cargo chef prepare --recipe-path recipe.json
11-
12-
FROM base as builder
13-
WORKDIR /app
14-
COPY --from=planner /app/recipe.json recipe.json
15-
RUN --mount=type=cache,target=$SCCACHE_DIR,sharing=locked \
16-
cargo chef cook --release --recipe-path recipe.json
17-
COPY . .
18-
RUN --mount=type=cache,target=$SCCACHE_DIR,sharing=locked \
19-
cargo xtask init
6+
7+
RUN cargo build --profile ephemeral-build
8+
RUN cargo xtask init

crates/xtask/chef.Dockerfile

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
FROM rust:latest AS base
2+
RUN cargo install sccache --version ^0.7
3+
RUN cargo install cargo-chef --version ^0.1
4+
ENV RUSTC_WRAPPER=sccache SCCACHE_DIR=/sccache
5+
6+
FROM base AS planner
7+
WORKDIR /app
8+
COPY . .
9+
RUN --mount=type=cache,target=$SCCACHE_DIR,sharing=locked \
10+
cargo chef prepare --recipe-path recipe.json
11+
12+
FROM base as builder
13+
WORKDIR /app
14+
COPY --from=planner /app/recipe.json recipe.json
15+
RUN --mount=type=cache,target=$SCCACHE_DIR,sharing=locked \
16+
cargo chef cook --release --recipe-path recipe.json
17+
COPY . .
18+
RUN --mount=type=cache,target=$SCCACHE_DIR,sharing=locked \
19+
cargo xtask init

0 commit comments

Comments
 (0)