From 9c6c201f56ffb16c6755e103f7fc31c188c143d6 Mon Sep 17 00:00:00 2001 From: Alexandre Fayolle Date: Thu, 29 Jan 2026 10:29:52 +0100 Subject: [PATCH 1/3] [ADD] pgvector extension --- Dockerfile | 15 +++++++++++++-- Makefile | 4 ++-- README.md | 1 + 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index cdfd74c..de430bd 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,9 +1,9 @@ ARG BASE_TAG ARG DEBIAN_RELEASE +ARG PGVECTOR_VERSION FROM postgres:${BASE_TAG}-${DEBIAN_RELEASE} AS builder - RUN apt-get update && \ - apt-get install -y unzip build-essential git wget libbrotli-dev + apt-get install -y unzip build-essential git wget libbrotli-dev postgresql-server-dev-$PG_MAJOR # Install Golang RUN wget https://go.dev/dl/go1.19.1.linux-amd64.tar.gz && \ @@ -33,6 +33,16 @@ RUN git checkout v2.0.1 && \ RUN ./main/pg/wal-g --version && \ cp ./main/pg/wal-g /wal-g-v2.0.1 +# Build pgvector extension +WORKDIR /tmp +RUN wget https://github.com/pgvector/pgvector/archive/refs/tags/v${PGVECTOR_VERSION}.tar.gz && \ + tar -xzf v${PGVECTOR_VERSION}.tar.gz && \ + rm v${PGVECTOR_VERSION}.tar.gz && \ + mv pgvector-${PGVECTOR_VERSION} pgvector + +WORKDIR /tmp/pgvector +RUN make && make DESTDIR=/pgvector_install install + ARG BASE_TAG ARG DEBIAN_RELEASE FROM postgres:${BASE_TAG}-${DEBIAN_RELEASE} @@ -57,6 +67,7 @@ RUN apt-get update && apt-get upgrade -y && \ apt-get clean && \ rm -rf /var/lib/apt/lists/* +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 diff --git a/Makefile b/Makefile index f3ceab3..ed07850 100644 --- a/Makefile +++ b/Makefile @@ -1,12 +1,12 @@ 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} -t camptocamp/postgres:${1}-postgis-$(subst $(space),-,${2}) . + 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 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}) sleep 10 diff --git a/README.md b/README.md index 4051175..a388f48 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,7 @@ This image extends the [official PostgreSQL image](https://hub.docker.com/_/post - [pgRouting](http://pgrouting.org/) - [PostgreSQL contrib package](https://packages.debian.org/sid/postgresql-contrib-9.6) - [Wal-g backup tools](https://github.com/wal-g/wal-g) +- [pgvector 0.8.1](https://github.com/pgvector/pgvector) See the PostgreSQL image documentation for more details: https://hub.docker.com/_/postgres/ From 94f6a1985911cca94b81d8ba7bb15ebe2fe81baa Mon Sep 17 00:00:00 2001 From: Julien Acroute Date: Mon, 2 Feb 2026 10:46:16 +0100 Subject: [PATCH 2/3] fix: variable usage --- Dockerfile | 2 +- Makefile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index de430bd..677a32b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ ARG BASE_TAG ARG DEBIAN_RELEASE -ARG PGVECTOR_VERSION FROM postgres:${BASE_TAG}-${DEBIAN_RELEASE} AS builder +ARG PGVECTOR_VERSION RUN apt-get update && \ apt-get install -y unzip build-essential git wget libbrotli-dev postgresql-server-dev-$PG_MAJOR diff --git a/Makefile b/Makefile index ed07850..2ae5599 100644 --- a/Makefile +++ b/Makefile @@ -6,7 +6,7 @@ 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} --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 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}) sleep 10 From a4baad52556370dff8a30d3975d978c69221d416 Mon Sep 17 00:00:00 2001 From: Julien Acroute Date: Mon, 2 Feb 2026 10:46:50 +0100 Subject: [PATCH 3/3] chore: remove build of old versions --- Makefile | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/Makefile b/Makefile index 2ae5599..e1160cb 100644 --- a/Makefile +++ b/Makefile @@ -20,19 +20,7 @@ define build-image docker system prune --all -f endef -all: 10 11 12 13 14 15 16 - -10: - $(call build-image,"10","3","bullseye") - -11: - $(call build-image,"11","3","bookworm") - -12: - $(call build-image,"12","3","bookworm") - -13: - $(call build-image,"13","3","bookworm") +all: 14 15 16 17 18 14: $(call build-image,"14","3","bookworm") @@ -45,3 +33,6 @@ all: 10 11 12 13 14 15 16 17: $(call build-image,"17","3","bookworm") + +18: + $(call build-image,"17","3","bookworm")