Support using OS other than Debian as base for custom images

Signed-off-by: Balasankar "Balu" C <balasankar@gitlab.com>
This commit is contained in:
Balasankar "Balu" C 2022-06-15 09:51:03 +05:30
parent 703c30315e
commit 0dea43ac3b
No known key found for this signature in database
GPG key ID: B77D2E2E23735427
14 changed files with 345 additions and 226 deletions

View file

@ -3,19 +3,30 @@ set -xeuo pipefail
IFS=$'\n\t'
POSTGRES_VERSION=${1:-12}
DEBIAN_VERSION=$(lsb_release -c -s)
export DEBIAN_FRONTEND=noninteractive
function build_debian() {
DEBIAN_VERSION=$(lsb_release -c -s)
# Uninstall the system client so that we don't have multiple versions
apt purge -y postgresql-client postgresql-client-common
export DEBIAN_FRONTEND=noninteractive
curl -sS -L https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add -
echo "deb http://apt.postgresql.org/pub/repos/apt/ ${DEBIAN_VERSION}-pgdg main" | tee /etc/apt/sources.list.d/postgresql.list
# Uninstall the system client so that we don't have multiple versions
apt purge -y postgresql-client postgresql-client-common
apt-get update
apt-get install -y postgresql-client-${POSTGRES_VERSION}
curl -sS -L https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add -
echo "deb http://apt.postgresql.org/pub/repos/apt/ ${DEBIAN_VERSION}-pgdg main" | tee /etc/apt/sources.list.d/postgresql.list
apt-get autoremove -yq
apt-get clean -yqq
rm -rf /var/lib/apt/lists/*
apt-get update
apt-get install -y postgresql-client-${POSTGRES_VERSION}
apt-get autoremove -yq
apt-get clean -yqq
rm -rf /var/lib/apt/lists/*
}
BUILD_OS=${BUILD_OS:-debian}
if [[ $BUILD_OS =~ debian ]]; then
build_debian "$@"
elif [[ $BUILD_OS =~ ubi ]]; then
build_ubi "$@"
fi