2024-08-13 09:20:08 +03:00
|
|
|
#!/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
|
|
|
|
|
2024-12-04 21:46:38 +03:00
|
|
|
POSTGRESQL_VERSION="${1:-16.6}"
|
2024-08-13 09:20:08 +03:00
|
|
|
PG_MAJOR="${POSTGRESQL_VERSION%%.*}"
|
|
|
|
|
|
|
|
img="docker.io/rockdrilla/postgresql:${POSTGRESQL_VERSION}"
|
2024-12-04 21:17:59 +03:00
|
|
|
deps="docker.io/rockdrilla/postgresql:deps-v2"
|
2024-08-13 09:20:08 +03:00
|
|
|
|
|
|
|
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"
|