diff --git a/scripts/post_build.sh b/scripts/post_build.sh new file mode 100644 index 00000000..50990895 --- /dev/null +++ b/scripts/post_build.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env bash + +set -euo pipefail + +if ! command -v bootc; then + rpm-ostree install bootc +fi + +bootupctl backend generate-update-metadata +rm -fr /tmp/* /var/* +ostree container commit diff --git a/template/templates/Containerfile.j2 b/template/templates/Containerfile.j2 index 548713e6..9d51e78e 100644 --- a/template/templates/Containerfile.j2 +++ b/template/templates/Containerfile.j2 @@ -38,7 +38,8 @@ RUN --mount=type=bind,from=stage-bins,src=/bins,dst=/tmp/bins \ {% call modules::main_modules_run(recipe.modules_ext, os_version) %} -RUN rm -fr /tmp/* /var/* && ostree container commit +RUN --mount=type=bind,from=ghcr.io/blue-build/cli:{{ exports_tag }}-build-scripts,src=/scripts/,dst=/scripts/ \ + /scripts/post_build.sh # Labels are added last since they cause cache misses with buildah LABEL {{ blue_build_utils::constants::BUILD_ID_LABEL }}="{{ build_id }}"