@@ -70,22 +70,25 @@ _git-build-vars:
7070# Note commonly you might want to override the base image via e.g.
7171# `just build --build-arg=base=quay.io/fedora/fedora-bootc:42`
7272#
73- # The Dockerfile builds RPMs internally in its 'build' stage, so we don't need
74- # to call 'package' first. This avoids cache invalidation from external files.
75- build : _keygen
76- #!/ bin/ bash
77- set -xeuo pipefail
78- eval $(just _git-build-vars)
79- podman build {{ base_buildargs}} --target=final \
80- - -build-arg=SOURCE_DATE_EPOCH=${SOURCE_DATE_EPOCH} \
81- - -build-arg=pkgversion=${VERSION} \
82- - t {{ base_img}} -bin {{ buildargs}} .
83- ./ hack/ build-sealed {{ variant}} {{ base_img}} -bin {{ base_img}} {{ sealed_buildargs}}
73+ # This first builds RPMs via the `package` target, then injects them
74+ # into the container image.
75+ build : package _keygen
76+ @ just _build-from-package target/ packages
8477
8578# Generate Secure Boot keys (only for our own CI/testing)
8679_ keygen :
8780 ./ hack/ generate-secureboot-keys
8881
82+ # Internal helper: build container image from packages at PATH
83+ _ build-from-package PATH :
84+ #!/ bin/ bash
85+ set -xeuo pipefail
86+ # Resolve to absolute path for podman volume mount
87+ # Use :z for SELinux relabeling
88+ pkg_path=$(realpath " {{ PATH}} " )
89+ podman build --target=final -v " ${pkg_path}" :/ run/ packages:ro,z -t {{ base_img}} -bin {{ buildargs}} .
90+ ./ hack/ build-sealed {{ variant}} {{ base_img}} -bin {{ base_img}} {{ sealed_buildargs}}
91+
8992# Build a sealed image from current sources.
9093build-sealed :
9194 @ just --justfile {{ justfile ()}} variant=composefs-sealeduki-sdboot build
@@ -108,34 +111,6 @@ package: _packagecontainer
108111 chmod a+ r target/ packages/ *.rpm
109112 podman rmi localhost/ bootc-pkg
110113
111- # Copy pre-existing packages from PATH into target/packages/
112- # Note: This is mainly for CI artifact extraction; build-from-package
113- # now uses volume mounts directly instead of copying to target/packages/.
114- copy-packages-from PATH :
115- #!/ bin/ bash
116- set -xeuo pipefail
117- if ! compgen -G " {{ PATH}} /*.rpm" > / dev/ null; then
118- echo " Error: No packages found in {{ PATH}} " >&2
119- exit 1
120- fi
121- mkdir -p target/ packages
122- rm -vf target/ packages/ *.rpm
123- cp -v {{ PATH}} / *.rpm target/ packages/
124- chmod a+ rx target target/ packages
125- chmod a+ r target/ packages/ *.rpm
126-
127- # Build the container image using pre-existing packages from PATH
128- # Uses the 'final-from-packages' target with a volume mount to inject packages,
129- # avoiding Docker context cache invalidation issues.
130- build-from-package PATH : _keygen
131- #!/ bin/ bash
132- set -xeuo pipefail
133- # Resolve to absolute path for podman volume mount
134- # Use :z for SELinux relabeling
135- pkg_path=$(realpath " {{ PATH}} " )
136- podman build {{ base_buildargs}} --target=final-from-packages -v " ${pkg_path}" :/ run/ packages:ro,z -t {{ base_img}} -bin {{ buildargs}} .
137- ./ hack/ build-sealed {{ variant}} {{ base_img}} -bin {{ base_img}} {{ sealed_buildargs}}
138-
139114# Pull images used by hack/lbi
140115_ pull-lbi-images :
141116 podman pull -q --retry 5 --retry-delay 5 s {{ lbi_images}}
@@ -146,8 +121,8 @@ build-integration-test-image: build _pull-lbi-images
146121 ./ hack/ build-sealed {{ variant}} {{ integration_img}} -bin {{ integration_img}} {{ sealed_buildargs}}
147122
148123# Build integration test image using pre-existing packages from PATH
149- build-integration-test-image-from-package PATH : _pull-lbi-images
150- @ just build -from-package {{ PATH}}
124+ build-integration-test-image-from-package PATH : _keygen _pull-lbi-images
125+ @ just _build -from-package {{ PATH}}
151126 cd hack && podman build {{ base_buildargs}} -t {{ integration_img}} -bin -f Containerfile .
152127 ./ hack/ build-sealed {{ variant}} {{ integration_img}} -bin {{ integration_img}} {{ sealed_buildargs}}
153128
0 commit comments