gitlab-build-images/scripts/install-postgresql
Stan Hu 9d6dd5061a
Update to Debian bullseye
bullseye is the latest stable, and this is what we will be using for
Cloud Native GitLab going forward so we should test with this.

Since an upgrade of the operating system may break pre-compiled C
extensions, we now introduce a DEBIAN environment flag that defaults
to the legacy buster install but allows us to roll out a bullseye
image with `debian-bullseye` as the image name prefix.
2022-02-09 14:15:39 -08:00

17 lines
486 B
Bash
Executable file

#!/bin/bash
set -xeuo pipefail
IFS=$'\n\t'
POSTGRES_VERSION=${1:-12}
DEBIAN_VERSION=${2:-buster}
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
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/*