From 8b9a485c32750035bd588cc313e3f81343c8ce50 Mon Sep 17 00:00:00 2001 From: makspll Date: Sat, 22 Feb 2025 10:45:44 +0000 Subject: [PATCH] chore: simplify docker image for debugging --- crates/xtask/Dockerfile | 21 +++++---------------- crates/xtask/chef.Dockerfile | 19 +++++++++++++++++++ 2 files changed, 24 insertions(+), 16 deletions(-) create mode 100644 crates/xtask/chef.Dockerfile diff --git a/crates/xtask/Dockerfile b/crates/xtask/Dockerfile index 11ef450f06..b4827c1609 100644 --- a/crates/xtask/Dockerfile +++ b/crates/xtask/Dockerfile @@ -1,19 +1,8 @@ FROM rust:latest AS base -RUN cargo install sccache --version ^0.7 -RUN cargo install cargo-chef --version ^0.1 -ENV RUSTC_WRAPPER=sccache SCCACHE_DIR=/sccache - -FROM base AS planner + WORKDIR /app + COPY . . -RUN --mount=type=cache,target=$SCCACHE_DIR,sharing=locked \ - cargo chef prepare --recipe-path recipe.json - -FROM base as builder -WORKDIR /app -COPY --from=planner /app/recipe.json recipe.json -RUN --mount=type=cache,target=$SCCACHE_DIR,sharing=locked \ - cargo chef cook --release --recipe-path recipe.json -COPY . . -RUN --mount=type=cache,target=$SCCACHE_DIR,sharing=locked \ - cargo xtask init \ No newline at end of file + +RUN cargo build --profile ephemeral-build +RUN cargo xtask init \ No newline at end of file diff --git a/crates/xtask/chef.Dockerfile b/crates/xtask/chef.Dockerfile new file mode 100644 index 0000000000..11ef450f06 --- /dev/null +++ b/crates/xtask/chef.Dockerfile @@ -0,0 +1,19 @@ +FROM rust:latest AS base +RUN cargo install sccache --version ^0.7 +RUN cargo install cargo-chef --version ^0.1 +ENV RUSTC_WRAPPER=sccache SCCACHE_DIR=/sccache + +FROM base AS planner +WORKDIR /app +COPY . . +RUN --mount=type=cache,target=$SCCACHE_DIR,sharing=locked \ + cargo chef prepare --recipe-path recipe.json + +FROM base as builder +WORKDIR /app +COPY --from=planner /app/recipe.json recipe.json +RUN --mount=type=cache,target=$SCCACHE_DIR,sharing=locked \ + cargo chef cook --release --recipe-path recipe.json +COPY . . +RUN --mount=type=cache,target=$SCCACHE_DIR,sharing=locked \ + cargo xtask init \ No newline at end of file