From 55c35fc8401534ebedfdc74f8bec64b903cc3dab Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Tue, 3 Jun 2025 19:00:00 +0000 Subject: [PATCH] docker: Simplify build/install; dedup cargo commands; enable gc. Signed-off-by: Jason Volk --- .github/workflows/README.md | 2 +- .github/workflows/bake.yml | 4 +- .github/workflows/main.yml | 20 +++++--- docker/Dockerfile.cargo | 8 ---- docker/Dockerfile.cargo.deb | 9 ---- docker/Dockerfile.cargo.deps | 12 +---- docker/Dockerfile.cargo.install | 81 --------------------------------- docker/Dockerfile.cargo.rpm | 9 +--- docker/Dockerfile.complement | 2 - docker/Dockerfile.cookware | 7 +-- docker/Dockerfile.diner | 3 -- docker/Dockerfile.ingredients | 8 ++-- docker/Dockerfile.install | 21 +++++++++ docker/Dockerfile.kitchen | 1 - docker/Dockerfile.rocksdb | 10 +--- docker/README.md | 48 +------------------ docker/bake.hcl | 48 ++++++++----------- 17 files changed, 66 insertions(+), 227 deletions(-) delete mode 100644 docker/Dockerfile.cargo.install create mode 100644 docker/Dockerfile.install diff --git a/.github/workflows/README.md b/.github/workflows/README.md index 23a81de0..53636563 100644 --- a/.github/workflows/README.md +++ b/.github/workflows/README.md @@ -3,7 +3,7 @@ The release pipeline `Main` (main.yml) and its subroutines defined in the other yamls form a high-level description for the underlying self-hosted build system in `/docker`. In other words, this is a sort of terminal, a "thin-client" with a display and a keyboard for our docker mainframe. We minimize -vendor-lockin and duplication with other frameworks by limiting everything here to only what is +vendor-lockin and duplication with other services by limiting everything here to only what is essential for driving the docker builder. Though we slightly relax the above by specifying details of the actual CI pipeline, the diff --git a/.github/workflows/bake.yml b/.github/workflows/bake.yml index 04408685..73f6b06a 100644 --- a/.github/workflows/bake.yml +++ b/.github/workflows/bake.yml @@ -121,7 +121,7 @@ jobs: docker/bake.sh "${{matrix.bake_target}}" # Optionally extract an inner artifact - - name: Extract Artifact + - name: Extract Inner Artifact if: > !failure() && !cancelled() && fromJSON(inputs.artifact)[matrix.bake_target].dst @@ -139,7 +139,7 @@ jobs: docker cp "$cid:$src" "_artifact/$dst" # Optionally extract the image itself as an artifact. - - name: Extract Image + - name: Extract Image Artifact if: > !failure() && !cancelled() && fromJSON(inputs.artifact)[matrix.bake_target].dst diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 57579f1a..811311bf 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -30,7 +30,8 @@ jobs: [ {"cargo_profile": "release-debuginfo", "rust_toolchain": "nightly"}, {"cargo_profile": "release-max-perf", "rust_toolchain": "stable"}, - {"cargo_profile": "release-max-perf", "feat_set": "none"} + {"cargo_profile": "release-max-perf", "feat_set": "none"}, + {"cargo_profile": "test", "rust_toolchain": "stable", "feat_set": "none"} ] outputs: @@ -56,12 +57,17 @@ jobs: set -e cat < ./buildkitd.toml [system] - platformsCacheMaxAge = "504h" - + platformsCacheMaxAge = "504h" [worker.oci] - enabled = true - rootless = true - gc = false + enabled = true + rootless = true + gc = true + [[worker.oci.gcpolicy]] + reservedSpace = "384GB" + maxUsedSpace = "768GB" + keepDuration = "504h" + filters = ["label!=cache==pin"] + all = true EOF docker buildx create \ @@ -160,7 +166,7 @@ jobs: !failure() && !cancelled() name: Publish - needs: [init, test, package] + needs: [package, test] uses: ./.github/workflows/publish.yml with: docker_repo: ${{vars.DOCKER_REPO}} diff --git a/docker/Dockerfile.cargo b/docker/Dockerfile.cargo index b11f0482..38e9511b 100644 --- a/docker/Dockerfile.cargo +++ b/docker/Dockerfile.cargo @@ -7,9 +7,6 @@ ARG RUSTUP_HOME ARG CARGO_HOME ARG CARGO_TARGET ARG CARGO_TARGET_DIR -ARG cargo_tgt_dst -ARG cargo_tgt_sub -ARG cargo_tgt_cache ARG cargo_profile ARG cargo_features ARG cargo_spec_features @@ -27,11 +24,6 @@ RUN \ --mount=type=cache,dst=${RUSTUP_HOME}/downloads,sharing=shared,ro \ --mount=type=cache,dst=${CARGO_HOME}/registry,sharing=shared,ro \ --mount=type=cache,dst=${CARGO_HOME}/git,sharing=shared,ro \ ---mount=type=cache,dst=${CARGO_TARGET_DIR},id=${cargo_tgt_dst},sharing=locked \ ---mount=type=cache,dst=${CARGO_TARGET_DIR}/${cargo_tgt_sub}/deps,id=${cargo_tgt_cache}/deps,sharing=locked \ ---mount=type=cache,dst=${CARGO_TARGET_DIR}/${cargo_tgt_sub}/build,id=${cargo_tgt_cache}/build,sharing=locked \ ---mount=type=cache,dst=${CARGO_TARGET_DIR}/${cargo_tgt_sub}/incremental,id=${cargo_tgt_cache}/incremental,sharing=locked \ ---mount=type=cache,dst=${CARGO_TARGET_DIR}/${cargo_tgt_sub}/.fingerprint,id=${cargo_tgt_cache}/fingerprint,sharing=locked \ <