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
15 changes: 13 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
ARG BASE_TAG
ARG DEBIAN_RELEASE
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
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 && \
Expand Down Expand Up @@ -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}
Expand All @@ -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

Expand Down
21 changes: 6 additions & 15 deletions Makefile
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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")
Expand All @@ -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")
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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/