Skip to content

Commit

Permalink
examples: step up our caching game
Browse files Browse the repository at this point in the history
This is the way it should have been done from the start, but I didn't
know about it at the time.

Also, add a bug reference for an unrelated workaround.

Signed-off-by: Allison Karlitskaya <[email protected]>
  • Loading branch information
allisonkarlitskaya committed Dec 5, 2024
1 parent 2da53b2 commit 9e30b48
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 11 deletions.
2 changes: 1 addition & 1 deletion examples/bls/Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
FROM fedora:rawhide
COPY extra /
COPY cfsctl /usr/bin
RUN <<EOF
RUN --mount=type=cache,target=/var/cache/libdnf5 <<EOF
set -eux
dnf --setopt keepcache=1 install -y systemd util-linux skopeo composefs strace dosfstools kernel
systemctl enable systemd-networkd
Expand Down
5 changes: 1 addition & 4 deletions examples/bls/build
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,9 @@ set -eux

cd "${0%/*}"

# https://github.com/containers/buildah/issues/5656
PODMAN_BUILD="podman build --no-cache"

if [ -d ~/.cache/container-build-cache ]; then
PODMAN_BUILD="${PODMAN_BUILD} --security-opt=label=disable --volume=${HOME}/.cache/container-build-cache:/var/cache:U"
fi

cargo build --release

cp ../../target/release/cfsctl .
Expand Down
4 changes: 2 additions & 2 deletions examples/uki/Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
FROM fedora:rawhide AS base
COPY extra /
COPY cfsctl /usr/bin
RUN <<EOF
RUN --mount=type=cache,target=/var/cache/libdnf5 <<EOF
set -eux
# we should install kernel-modules here, but can't
# because it'll pull in the entire kernel with it
Expand All @@ -39,7 +39,7 @@ EOF

FROM base AS kernel
ARG COMPOSEFS_FSVERITY
RUN <<EOF
RUN --mount=type=cache,target=/var/cache/libdnf5 <<EOF
set -eux
mkdir -p /etc/kernel /etc/dracut.conf.d
echo "composefs=${COMPOSEFS_FSVERITY} rw" > /etc/kernel/cmdline
Expand Down
5 changes: 1 addition & 4 deletions examples/uki/build
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,9 @@ set -eux

cd "${0%/*}"

# https://github.com/containers/buildah/issues/5656
PODMAN_BUILD="podman build --no-cache"

if [ -d ~/.cache/container-build-cache ]; then
PODMAN_BUILD="${PODMAN_BUILD} --security-opt=label=disable --volume=${HOME}/.cache/container-build-cache:/var/cache:U"
fi

cargo build --release

cp ../../target/release/cfsctl .
Expand Down

0 comments on commit 9e30b48

Please sign in to comment.