diff --git a/Containerfile b/Containerfile index 2c344af..4aec1ba 100644 --- a/Containerfile +++ b/Containerfile @@ -20,6 +20,10 @@ ADD /root/ /root/ ADD /etc/ /etc/ ADD /home/ /home/ +# The build type: either `dev` or `prod` +# In `dev` mode: the package manager will not be deleted. +ARG BUILD_TYPE=prod + # Allow image-builders to choose another version besides "latest" should # an incompatible change be introduced. ARG RUNNER_VERSION=latest @@ -35,9 +39,11 @@ ARG TARGETARCH=amd64 ARG PRUNE_INTERVAL=daily # see systemd.timer for allowable values # All-in-one packaging/image-setup script to keep things simple. -RUN PRUNE_INTERVAL=${PRUNE_INTERVAL} \ - RUNNER_VERSION=${RUNNER_VERSION} \ - bash /root/setup.sh +RUN \ + PRUNE_INTERVAL=${PRUNE_INTERVAL} \ + RUNNER_VERSION=${RUNNER_VERSION} \ + BUILD_TYPE=${BUILD_TYPE} \ + bash /root/setup.sh VOLUME /cache /home/podman/.local/share/containers ENTRYPOINT /lib/systemd/systemd diff --git a/root/setup.sh b/root/setup.sh index e50fed9..3973277 100644 --- a/root/setup.sh +++ b/root/setup.sh @@ -33,6 +33,10 @@ function check_vars() { die "Env. variable '$varname' must be non-empty." fi done + + if [[ ! "$BUILD_TYPE" =~ dev|prod ]]; then + die "Build type must be 'dev' or 'prod': '$BUILD_TYPE'." + fi } function main() { @@ -51,6 +55,10 @@ function main() { finalize_ownership } +function is_release() { + [ "$BUILD_TYPE" = "prod" ] || return 1 +} + function install_packages() { readarray xpackages < <(grep -vE '^(# )+'