From 67e3f0553ccb021bdfc9c0dfb67bc51c91aad49d Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Fri, 12 Jan 2024 14:53:19 -0500 Subject: [PATCH] hack/Containerfile: New file for local container builds This is a relatively efficient container-oriented build flow suitable for local iteration. Signed-off-by: Colin Walters --- .dockerignore | 4 ++++ hack/Containerfile | 13 +++++++++++++ 2 files changed, 17 insertions(+) create mode 100644 hack/Containerfile diff --git a/.dockerignore b/.dockerignore index eae2fec0..5585c60f 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,2 +1,6 @@ .cosa +_kola_temp +docs +ci +hack target diff --git a/hack/Containerfile b/hack/Containerfile new file mode 100644 index 00000000..778e5e0d --- /dev/null +++ b/hack/Containerfile @@ -0,0 +1,13 @@ +# This container build is just a demo effectively; it shows how one might +# build bootc in a container flow, using Fedora ELN as the target. +FROM quay.io/centos-bootc/fedora-bootc:eln as build +RUN dnf config-manager --set-enabled eln-crb && dnf -y install cargo ostree-devel openssl-devel && dnf clean all +COPY . /build +WORKDIR /build +# 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 bin-archive && mkdir -p /out && cp target/bootc.tar.zst /out + +FROM quay.io/centos-bootc/fedora-bootc:eln +COPY --from=build /out/bootc.tar.zst /tmp +RUN tar -C / --zstd -xvf /tmp/bootc.tar.zst && rm -vf /tmp/*