Skip to content

Commit d53d7b0

Browse files
CoderYellowclaude
andcommitted
build: debian runtime mirror, release-to-release Docker cache
- runtime base image from ghcr.io/openprojectx/dockerhub mirror - dependency layer keyed on a version-normalized Cargo.toml so release version bumps don't invalidate it - CI builds the image (push=false) on master to seed the buildx GHA cache; tag runs can only restore caches from the default branch Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent 0fc2495 commit d53d7b0

3 files changed

Lines changed: 31 additions & 6 deletions

File tree

.github/workflows/ci.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,18 @@ jobs:
3939
run: cargo test --features integration --test integration_rustfs
4040
- name: E2E tests (k3s + RustFS containers)
4141
run: cargo test --features e2e --test e2e_k3s
42+
43+
# Validates the Dockerfile and seeds the buildx GHA cache on the default
44+
# branch, so tag-triggered release builds can restore it (Actions cache is
45+
# isolated per ref except for the default branch).
46+
image-build:
47+
runs-on: ubuntu-latest
48+
steps:
49+
- uses: actions/checkout@v4
50+
- uses: docker/setup-buildx-action@v3
51+
- uses: docker/build-push-action@v6
52+
with:
53+
context: .
54+
push: false
55+
cache-from: type=gha
56+
cache-to: type=gha,mode=max

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "rustfs-operator"
3-
version = "0.2.1"
3+
version = "0.2.2"
44
edition = "2024"
55
rust-version = "1.92"
66
license = "MIT OR Apache-2.0"

Dockerfile

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,32 @@
1-
FROM ghcr.io/openprojectx/dockerhub/library/rust:1.97.0-trixie AS builder
1+
FROM ghcr.io/openprojectx/dockerhub/library/rust:1.97.0-trixie AS base
2+
3+
# Normalize the manifest so routine version bumps don't invalidate the
4+
# dependency layer below.
5+
FROM base AS manifest
6+
COPY Cargo.toml /normalized/Cargo.toml
7+
RUN sed -i 's/^version = ".*"/version = "0.0.0"/' /normalized/Cargo.toml
8+
9+
FROM base AS builder
210
WORKDIR /build
311

412
# Dependency layer: build all dependencies against dummy sources so the
5-
# layer is keyed on Cargo.toml only and survives source-code changes
6-
# (persisted across CI runs by the buildx GHA cache).
7-
COPY Cargo.toml ./
13+
# layer is keyed on the (normalized) Cargo.toml only and survives source
14+
# changes. Persisted across CI runs by the buildx GHA cache, seeded from
15+
# master builds (tag runs can only restore default-branch caches).
16+
COPY --from=manifest /normalized/Cargo.toml ./Cargo.toml
817
RUN mkdir src \
918
&& echo 'fn main() {}' > src/main.rs \
1019
&& touch src/lib.rs \
1120
&& cargo build --release --bin rustfs-operator \
1221
&& rm -rf src
1322

23+
COPY Cargo.toml ./
1424
COPY src ./src
1525
# touch so cargo rebuilds the crate itself against the real sources
1626
RUN touch src/main.rs src/lib.rs \
1727
&& cargo build --release --bin rustfs-operator
1828

19-
FROM debian:trixie-slim
29+
FROM ghcr.io/openprojectx/dockerhub/library/debian:trixie-slim
2030
RUN apt-get update \
2131
&& apt-get install -y --no-install-recommends ca-certificates \
2232
&& rm -rf /var/lib/apt/lists/* \

0 commit comments

Comments
 (0)