#!/bin/sh set -ef cd "$(dirname "$0")/.." IMAGE_VERSION="${IMAGE_VERSION:-v0.0.6}" set -a BUILDAH_FORMAT="${BUILDAH_FORMAT:-docker}" BUILDAH_ISOLATION="${BUILDAH_ISOLATION:-chroot}" BUILDAH_NETWORK="${BUILDAH_NETWORK:-host}" set +a PYTHONTAG="${PYTHONTAG:-3.11.10-slim-bookworm}" grab_site_packages() { podman run \ --pull=always --rm \ --entrypoint='[]' \ --user=nobody:nogroup \ -e LANG=C.UTF-8 \ -e LC_ALL=C.UTF-8 \ -e MALLOC_ARENA_MAX=2 \ -e PYTHONUNBUFFERED=1 \ -e PYTHONDONTWRITEBYTECODE=1 \ "$1" \ python3 -c 'import site;print(site.getsitepackages()[0])' } PYTHON_SITE_PACKAGES=$(grab_site_packages "docker.io/python:${PYTHONTAG}") [ -n "${PYTHON_SITE_PACKAGES:?}" ] img="docker.io/rockdrilla/angie-conv:${IMAGE_VERSION}-base" buildah bud --network="${BUILDAH_NETWORK}" \ -f ./Dockerfile.base \ -t "${img}" \ --pull=missing --no-cache --squash \ --build-arg "PYTHONTAG=${PYTHONTAG}" \ --env "PYTHON_SITE_PACKAGES=${PYTHON_SITE_PACKAGES}" \ --unsetenv GPG_KEY \ --unsetenv PYTHON_PIP_VERSION \ --unsetenv PYTHON_SETUPTOOLS_VERSION \ --unsetenv PYTHON_GET_PIP_SHA256 \ --unsetenv PYTHON_GET_PIP_URL \ c=$(buildah from --pull=never "${img}") || true if [ -z "$c" ] ; then buildah rmi -f "${img}" exit 1 fi buildah config --created-by /usr/local/share/Dockerfile.base "$c" buildah commit --rm --squash "$c" "${img}"