# Build bootc from the current git into a c9s-bootc container image. # Use e.g. --build-arg=base=quay.io/fedora/fedora-bootc:41 to target # Fedora instead. # # You can also generate an image with cloud-init and other dependencies # with `--build-arg=tmt` which is intended for use particularly via # https://tmt.readthedocs.io/en/stable/ ARG base=quay.io/centos-bootc/centos-bootc:stream9 FROM $base as build # Keep this stuff before the `COPY . /build` below to ensure that the packages # are cached, i.e. we don't invalidate the package install stage by editing the source. COPY contrib /contrib COPY hack/build.sh /build.sh RUN /build.sh && rm -v /build.sh COPY . /build WORKDIR /build RUN mkdir -p /build/target/dev-rootfs # This can hold arbitrary extra content # See https://www.reddit.com/r/rust/comments/126xeyx/exploring_the_problem_of_faster_cargo_docker/ # We aren't using the full recommendations there, just the simple bits. RUN --mount=type=cache,target=/build/target --mount=type=cache,target=/var/roothome make test-bin-archive && mkdir -p /out && cp target/bootc.tar.zst /out FROM $base # We support e.g. adding cloud-init ARG variant= COPY hack/provision-derived.sh /tmp RUN /tmp/provision-derived.sh "$variant" && rm -f /tmp/*.sh # Also copy in some default install configs we use for testing COPY hack/install-test-configs/* /usr/lib/bootc/install/ # And some test kargs COPY hack/test-kargs /usr/lib/bootc/kargs.d/ # Inject our built code COPY --from=build /out/bootc.tar.zst /tmp RUN tar -C / --zstd -xvf /tmp/bootc.tar.zst && rm -vrf /tmp/* # Also copy over arbitrary bits from the target root COPY --from=build /build/target/dev-rootfs/ / # Test our own linting RUN bootc container lint --fatal-warnings