-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy pathContainerfile
More file actions
55 lines (45 loc) · 1.92 KB
/
Containerfile
File metadata and controls
55 lines (45 loc) · 1.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# Containerfile for composefs-rs integration testing
#
# Builds cfsctl and integration test binaries, then produces a bootable
# (bootc-compatible) container image suitable for privileged integration
# testing via `bcvk ephemeral run-ssh`.
#
# Build:
# podman build --tag composefs-rs-test .
# podman build --build-arg base_image=ghcr.io/bootcrew/debian-bootc:latest --tag composefs-rs-test-debian .
#
# Uses BuildKit-style cache mounts for fast incremental Rust builds.
# Note: when switching between base images locally, run
# podman system prune --volumes
# to clear stale build caches that may be incompatible across distros.
ARG base_image=quay.io/centos-bootc/centos-bootc:stream10
ARG cfsctl_features=pre-6.15
# -- source snapshot (keeps layer graph clean) --
FROM scratch AS src
COPY . /src
# -- build stage --
FROM ${base_image} AS build
ARG cfsctl_features
COPY --from=src /src/contrib /src/contrib
RUN /src/contrib/packaging/install-build-deps.sh
COPY --from=src /src /src
WORKDIR /src
# Fetch dependencies (network-intensive, cached separately)
RUN --mount=type=cache,target=/src/target \
--mount=type=cache,target=/root/.cargo/registry \
--mount=type=cache,target=/root/.cargo/git \
cargo fetch
# Build cfsctl and integration test binary
RUN --network=none \
--mount=type=cache,target=/src/target \
--mount=type=cache,target=/root/.cargo/registry \
--mount=type=cache,target=/root/.cargo/git \
cargo build --release -p cfsctl --features="${cfsctl_features}" -p integration-tests && \
cp /src/target/release/cfsctl /usr/bin/cfsctl && \
cp /src/target/release/cfsctl-integration-tests /usr/bin/cfsctl-integration-tests
# -- final bootable image --
FROM ${base_image}
COPY --from=src /src/contrib /src/contrib
RUN /src/contrib/packaging/install-test-deps.sh && rm -rf /src
COPY --from=build /usr/bin/cfsctl /usr/bin/cfsctl
COPY --from=build /usr/bin/cfsctl-integration-tests /usr/bin/cfsctl-integration-tests