File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11name : image
22
3- # Canonical release: on a version tag, build the collector image from source ( clean-room,
4- # reproducible — unlike a manual host build ) and push to GHCR. The internal A3S registry
5- # (what the cluster pulls from ) is then fed by promoting/mirroring this image.
3+ # Canonical release: on a version tag, build the collector clean-room (the eBPF crate +
4+ # userspace binary ) and push the runtime image to GHCR. The internal A3S registry (what the
5+ # egress-constrained cluster pulls) is fed by promoting/mirroring this image.
66on :
77 push :
88 tags : ['v*']
@@ -14,9 +14,16 @@ permissions:
1414
1515jobs :
1616 image :
17- runs-on : ubuntu-latest
17+ runs-on : ubuntu-latest # 24.04 — glibc matches the ubuntu:24.04 runtime base
1818 steps :
1919 - uses : actions/checkout@v4
20+ - uses : dtolnay/rust-toolchain@nightly
21+ with :
22+ components : rust-src # build-std for the bpfel-unknown-none eBPF target
23+ - run : cargo install bpf-linker --locked
24+ - run : cargo build --release -p a3s-observer-collector
25+ - name : stage binary (small build context)
26+ run : mkdir -p dist && cp target/release/a3s-observer-collector dist/
2027 - uses : docker/setup-buildx-action@v3
2128 - uses : docker/login-action@v3
2229 with :
3239 type=ref,event=tag
3340 - uses : docker/build-push-action@v6
3441 with :
35- context : .
36- file : deploy/Dockerfile # multi-stage: builds the eBPF + collector from source
42+ context : dist
43+ file : deploy/Dockerfile
3744 push : true
3845 tags : ${{ steps.meta.outputs.tags }}
3946 labels : ${{ steps.meta.outputs.labels }}
Original file line number Diff line number Diff line change 1- # Build the collector (with the eBPF toolchain) then ship just the binary.
2- # Build from the crate root: docker build -f deploy/Dockerfile -t a3s-observer:0.2.0 .
1+ # Runtime image for a3s-observer-collector.
32#
4- # bpf-linker borrows rustc's bundled LLVM (aya-rustc-llvm-proxy), so no system LLVM is
5- # needed; build.rs compiles the eBPF crate with the nightly toolchain + rust-src.
6-
7- FROM rust:1-bookworm AS build
8- RUN rustup toolchain install nightly --component rust-src \
9- && cargo install bpf-linker
10- WORKDIR /src
11- COPY . .
12- RUN cargo build --release -p a3s-observer-collector
13-
14- FROM debian:bookworm-slim
15- COPY --from=build /src/target/release/a3s-observer-collector /usr/local/bin/a3s-observer-collector
3+ # Two steps (this is what .github/workflows/image.yml does, and what was validated by hand):
4+ # 1. build the binary: cargo build --release -p a3s-observer-collector
5+ # 2. stage + build: mkdir -p dist && cp target/release/a3s-observer-collector dist/
6+ # docker build -f deploy/Dockerfile -t a3s-observer dist
7+ #
8+ # The base must match the build host's glibc — the binary is dynamically linked. CI builds on
9+ # ubuntu-latest (24.04) and ships on ubuntu:24.04; keep them in lockstep (or build static musl
10+ # for a distroless/scratch base).
11+ FROM ubuntu:24.04
12+ COPY a3s-observer-collector /usr/local/bin/a3s-observer-collector
1613ENV A3S_OBSERVER_JSON=1
1714ENTRYPOINT ["/usr/local/bin/a3s-observer-collector" ]
You can’t perform that action at this time.
0 commit comments