postgresql-citus-patroni-image/build-scripts/image.sh
2024-08-13 09:20:08 +03:00

32 lines
808 B
Bash
Executable File

#!/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.4}"
PG_MAJOR="${POSTGRESQL_VERSION%%.*}"
img="docker.io/rockdrilla/postgresql:${POSTGRESQL_VERSION}"
deps="docker.io/rockdrilla/postgresql:deps-v1"
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"