Skip to content

Instantly share code, notes, and snippets.

@ruifung
Created June 11, 2023 10:47
Show Gist options
  • Save ruifung/76a396352f618000d38b7d893f35c19d to your computer and use it in GitHub Desktop.
Save ruifung/76a396352f618000d38b7d893f35c19d to your computer and use it in GitHub Desktop.
crunchydata postgres image-mod
$POSTGRES_VERSION="14.7"
$POSTGIS_VERSION="3.3"
$BUILD_NUMBER="0"
$POSTGRES_MAJOR="14"
$TIMESCALE_MAJOR="2"
$TIMESCALE_VERSION="2.11.0"
$TIMESCALE_TOOKIT_VERSION="1.16.0"
$TIMESCALE_OLD_VERSION="2.9.3"
$TSTOOLKIT_OLD_VERSION="1.13.1"
$PATRONI_VER="3.0.2"
$MOD_BUILD_NUMBER="1"
docker buildx build `
--push `
--platform linux/arm64,linux/amd64 `
--build-arg POSTGRES_VERSION=$POSTGRES_VERSION `
--build-arg POSTGIS_VERSION=$POSTGIS_VERSION `
--build-arg BUILD_NUMBER=$BUILD_NUMBER `
--build-arg POSTGRES_MAJOR=$POSTGRES_MAJOR `
--build-arg TIMESCALE_MAJOR=$TIMESCALE_MAJOR `
--build-arg TIMESCALE_VERSION=$TIMESCALE_VERSION `
--build-arg TIMESCALE_TOOKIT_VERSION=$TIMESCALE_TOOKIT_VERSION `
--build-arg TIMESCALE_OLD_VERSION=$TIMESCALE_OLD_VERSION `
--build-arg TSTOOLKIT_OLD_VERSION=$TSTOOLKIT_OLD_VERSION `
--build-arg PATRONI_VER=$PATRONI_VER `
-t harbor.services.home.arpa/local-images/crunchy-postgres-gis-ts:ubi8-$POSTGRES_VERSION-$POSTGIS_VERSION-$TIMESCALE_VERSION-$MOD_BUILD_NUMBER .
ARG POSTGRES_VERSION
ARG POSTGIS_VERSION
ARG BUILD_NUMBER
FROM registry.developers.crunchydata.com/crunchydata/crunchy-postgres-gis:ubi8-${POSTGRES_VERSION}-${POSTGIS_VERSION}-${BUILD_NUMBER}
USER root
ARG POSTGRES_MAJOR
ARG TIMESCALE_MAJOR
ARG TIMESCALE_VERSION
ARG TIMESCALE_TOOKIT_VERSION
ARG TIMESCALE_OLD_VERSION
ARG TSTOOLKIT_OLD_VERSION
RUN curl -sSL -o /etc/yum.repos.d/timescale_timescaledb.repo "https://packagecloud.io/install/repositories/timescale/timescaledb/config_file.repo?os=el&dist=8" && \
microdnf --disablerepo=crunchypg${POSTGRES_MAJOR} update -y && \
microdnf --disablerepo=crunchypg${POSTGRES_MAJOR} install -y timescaledb-${TIMESCALE_MAJOR}-postgresql-${POSTGRES_MAJOR}-${TIMESCALE_VERSION} && \
microdnf --disablerepo=crunchypg${POSTGRES_MAJOR} install -y timescaledb-toolkit-postgresql-${POSTGRES_MAJOR}-${TIMESCALE_TOOKIT_VERSION} && \
microdnf --disablerepo=crunchypg${POSTGRES_MAJOR} install -y timescaledb-${TIMESCALE_MAJOR}-postgresql-${POSTGRES_MAJOR}-${TIMESCALE_OLD_VERSION} && \
microdnf --disablerepo=crunchypg${POSTGRES_MAJOR} install -y timescaledb-toolkit-postgresql-${POSTGRES_MAJOR}-${TSTOOLKIT_OLD_VERSION} && \
microdnf clean all
ARG PATRONI_VER
# install patroni for Kube
RUN pip3 install --upgrade python-dateutil \
&& pip3 install patroni[kubernetes]=="${PATRONI_VER}"
USER 26
# magical user used here: https://github.com/CrunchyData/crunchy-containers/blob/master/build/postgres-gis/Dockerfile
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment