Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions 99force-gpgv
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
APT::Key::gpgvcommand "/usr/bin/gpgv";
50 changes: 36 additions & 14 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
ARG BASE_TAG
ARG DEBIAN_RELEASE
FROM postgres:${BASE_TAG}-${DEBIAN_RELEASE} AS builder
ARG PGVECTOR_VERSION
FROM postgres:${BASE_TAG}-trixie AS builder

ENV PGVECTOR_VERSION=0.8.1
RUN apt-get update && \
apt-get install -y unzip build-essential git wget libbrotli-dev postgresql-server-dev-$PG_MAJOR

Expand Down Expand Up @@ -44,29 +44,51 @@ WORKDIR /tmp/pgvector
RUN make && make DESTDIR=/pgvector_install install

ARG BASE_TAG
ARG DEBIAN_RELEASE
FROM postgres:${BASE_TAG}-${DEBIAN_RELEASE}
FROM postgres:${BASE_TAG}-trixie

ARG POSTGIS_VERSIONS
ENV DEBIAN_FRONTEND=noninteractive \
LANG=C.UTF-8

RUN cp /usr/share/i18n/SUPPORTED /etc/locale.gen && \
locale-gen

ADD 99force-gpgv /tmp/99force-gpgv

RUN apt-get update && apt-get upgrade -y && \
apt-get install -y libbrotli-dev && \
echo "Postgis versions '$POSTGIS_VERSIONS'" && \
for POSTGIS_VERSION in ${POSTGIS_VERSIONS}; do \
apt-get install --no-install-recommends -y \
postgresql-$PG_MAJOR-postgis-$POSTGIS_VERSION \
postgresql-$PG_MAJOR-postgis-$POSTGIS_VERSION-scripts; \
done && \
apt-get install -y gpgv libbrotli-dev curl lsb-release ca-certificates gnupg && \
mv /tmp/99force-gpgv /etc/apt/apt.conf.d/99force-gpgv && \
echo "deb http://apt.dalibo.org/labs $(lsb_release -cs)-dalibo main" > /etc/apt/sources.list.d/dalibo-labs.list && \
curl -fsSL -o /etc/apt/trusted.gpg.d/dalibo-labs.gpg https://apt.dalibo.org/labs/debian-dalibo.gpg && \
apt-get update && \
apt-get install --no-install-recommends -y \
postgresql-$PG_MAJOR-postgis-3 \
postgresql-$PG_MAJOR-postgis-3-scripts \
postgresql_anonymizer_$PG_MAJOR; \
apt-get install --no-install-recommends -y postgresql-$PG_MAJOR-pgrouting && \
apt-get install -y ca-certificates tmux screen curl less && \
apt-get install -y tmux screen less && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

ARG BARMAN_VERSION="3.17.0"

# We need to break the system packages to install barman-cloud in bookworm and later
ENV PIP_BREAK_SYSTEM_PACKAGES=1

USER root
RUN apt-get update && \
apt-get install -y --no-install-recommends \
# We require build-essential and python3-dev to build lz4 on arm64 since there isn't a pre-compiled wheel available
build-essential python3-dev \
python3-pip \
python3-psycopg2 \
python3-setuptools \
&& \
pip3 install --no-cache-dir barman[cloud,azure,snappy,google,zstandard,lz4]==${BARMAN_VERSION} && \
python3 -c "import sysconfig, compileall; compileall.compile_dir(sysconfig.get_path('stdlib'), quiet=1); compileall.compile_dir(sysconfig.get_path('purelib'), quiet=1); compileall.compile_dir(sysconfig.get_path('platlib'), quiet=1)" && \
apt-get remove -y --purge --autoremove build-essential python3-dev && \
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false && \
rm -rf /var/lib/apt/lists/* /var/cache/* /var/log/*

COPY --from=builder /pgvector_install /
COPY --from=builder /wal-g-v1.1 /usr/local/bin/wal-g-v1.1
COPY --from=builder /wal-g-v2.0.1 /usr/local/bin/wal-g-v2.0.1
Expand Down
25 changes: 9 additions & 16 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,38 +1,31 @@
space := $(subst ,, )
PGHOST := $(shell ip -json addr|jq -r '.[] | select(.ifname | test("^docker0$$")) | .addr_info[] | select(.family | test("^inet$$")) | .local')
PGVECTOR_VERSION := 0.8.1

define build-image
@echo Base tag $1
@echo Postgis versions $2
@echo Debian release $3
docker build --pull --no-cache --build-arg BASE_TAG=${1} --build-arg POSTGIS_VERSIONS=${2} --build-arg DEBIAN_RELEASE=${3} --build-arg PGVECTOR_VERSION=$(PGVECTOR_VERSION) -t camptocamp/postgres:${1}-postgis-$(subst $(space),-,${2}) .
docker build --pull --no-cache --build-arg BASE_TAG=${1} -t ghcr.io/camptocamp/postgres:${1} .
docker stop db || true
docker run --rm --name=db --detach --publish=5432:5432 --env=POSTGRES_USER=www-data --env=POSTGRES_PASSWORD=www-data --env=POSTGRES_DB=test camptocamp/postgres:${1}-postgis-$(subst $(space),-,${2})
docker run --rm --name=db --detach --publish=5432:5432 --env=POSTGRES_USER=www-data --env=POSTGRES_PASSWORD=www-data --env=POSTGRES_DB=test ghcr.io/camptocamp/postgres:${1}
sleep 10
docker logs db
docker run --rm --env=PGUSER=www-data --env=PGPASSWORD=www-data --env=PGDATABASE=test --env=PGPORT=5432 --env=PGHOST=$(PGHOST) \
camptocamp/postgres:${1}-postgis-$(subst $(space),-,${2}) psql --command="SELECT 1"
docker run --rm --env=PGUSER=www-data --env=PGPASSWORD=www-data --env=PGDATABASE=test --env=PGPORT=5432 --env=PGHOST=$(PGHOST) ghcr.io/camptocamp/postgres:${1} psql --command="SELECT 1"
docker stop db
$(if ${PUSH_DOCKER_HUB},docker push camptocamp/postgres:${1}-postgis-$(subst $(space),-,${2}),)
$(if ${PUSH_GHCR},docker tag camptocamp/postgres:${1}-postgis-$(subst $(space),-,${2}) ghcr.io/camptocamp/postgres:${1}-postgis-$(subst $(space),-,${2}),)
$(if ${PUSH_GHCR},docker push ghcr.io/camptocamp/postgres:${1}-postgis-$(subst $(space),-,${2}),)
$(if ${PUSH_GHCR},docker push ghcr.io/camptocamp/postgres:${1},)
docker system prune --all -f
endef

all: 14 15 16 17 18

14:
$(call build-image,"14","3","trixie")
$(call build-image,"14")

15:
$(call build-image,"15","3","trixie")
$(call build-image,"15")

16:
$(call build-image,"16","3","trixie")
$(call build-image,"16")

17:
$(call build-image,"17","3","trixie")
$(call build-image,"17")

18:
$(call build-image,"18","3","trixie")
$(call build-image,"18")
Loading