#!/bin/sh set -ef cd "$(dirname "$0")/.." set -a BUILDAH_FORMAT="${BUILDAH_FORMAT:-docker}" BUILDAH_ISOLATION="${BUILDAH_ISOLATION:-chroot}" BUILDAH_NETWORK="${BUILDAH_NETWORK:-host}" set +a POSTGRESQL_VERSION="${1:-16.6}" PG_MAJOR="${POSTGRESQL_VERSION%%.*}" img="docker.io/rockdrilla/postgresql:${POSTGRESQL_VERSION}" deps="docker.io/rockdrilla/postgresql:deps-v2" c=$(buildah from --pull=missing "${deps}") [ -n "${c:?}" ] buildah config --env "POSTGRESQL_VERSION=${POSTGRESQL_VERSION}" "$c" buildah config --env "PG_MAJOR=${PG_MAJOR}" "$c" buildah commit --rm "$c" "${img}-env" unset c buildah bud \ -f ./Dockerfile \ -t "${img}" \ --pull=missing --no-cache \ --build-arg "DEPS_IMAGE=${img}-env" \ --build-arg "UPSTREAM_IMAGE_VERSION=${POSTGRESQL_VERSION}" \ podman image rm "${img}-env"