Skip to content

Commit 35a7f8f

Browse files
authored
Merge pull request #22 from gurneyalex/add-pgvector
[ADD] pgvector extension
2 parents 9a36024 + a4baad5 commit 35a7f8f

3 files changed

Lines changed: 20 additions & 17 deletions

File tree

Dockerfile

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
ARG BASE_TAG
22
ARG DEBIAN_RELEASE
33
FROM postgres:${BASE_TAG}-${DEBIAN_RELEASE} AS builder
4-
4+
ARG PGVECTOR_VERSION
55
RUN apt-get update && \
6-
apt-get install -y unzip build-essential git wget libbrotli-dev
6+
apt-get install -y unzip build-essential git wget libbrotli-dev postgresql-server-dev-$PG_MAJOR
77

88
# Install Golang
99
RUN wget https://go.dev/dl/go1.19.1.linux-amd64.tar.gz && \
@@ -33,6 +33,16 @@ RUN git checkout v2.0.1 && \
3333
RUN ./main/pg/wal-g --version && \
3434
cp ./main/pg/wal-g /wal-g-v2.0.1
3535

36+
# Build pgvector extension
37+
WORKDIR /tmp
38+
RUN wget https://github.com/pgvector/pgvector/archive/refs/tags/v${PGVECTOR_VERSION}.tar.gz && \
39+
tar -xzf v${PGVECTOR_VERSION}.tar.gz && \
40+
rm v${PGVECTOR_VERSION}.tar.gz && \
41+
mv pgvector-${PGVECTOR_VERSION} pgvector
42+
43+
WORKDIR /tmp/pgvector
44+
RUN make && make DESTDIR=/pgvector_install install
45+
3646
ARG BASE_TAG
3747
ARG DEBIAN_RELEASE
3848
FROM postgres:${BASE_TAG}-${DEBIAN_RELEASE}
@@ -57,6 +67,7 @@ RUN apt-get update && apt-get upgrade -y && \
5767
apt-get clean && \
5868
rm -rf /var/lib/apt/lists/*
5969

70+
COPY --from=builder /pgvector_install /
6071
COPY --from=builder /wal-g-v1.1 /usr/local/bin/wal-g-v1.1
6172
COPY --from=builder /wal-g-v2.0.1 /usr/local/bin/wal-g-v2.0.1
6273

Makefile

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
space := $(subst ,, )
22
PGHOST := $(shell ip -json addr|jq -r '.[] | select(.ifname | test("^docker0$$")) | .addr_info[] | select(.family | test("^inet$$")) | .local')
3-
3+
PGVECTOR_VERSION := 0.8.1
44

55
define build-image
66
@echo Base tag $1
77
@echo Postgis versions $2
88
@echo Debian release $3
9-
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}) .
9+
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}) .
1010
docker stop db || true
1111
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})
1212
sleep 10
@@ -20,19 +20,7 @@ define build-image
2020
docker system prune --all -f
2121
endef
2222

23-
all: 10 11 12 13 14 15 16
24-
25-
10:
26-
$(call build-image,"10","3","bullseye")
27-
28-
11:
29-
$(call build-image,"11","3","bookworm")
30-
31-
12:
32-
$(call build-image,"12","3","bookworm")
33-
34-
13:
35-
$(call build-image,"13","3","bookworm")
23+
all: 14 15 16 17 18
3624

3725
14:
3826
$(call build-image,"14","3","bookworm")
@@ -45,3 +33,6 @@ all: 10 11 12 13 14 15 16
4533

4634
17:
4735
$(call build-image,"17","3","bookworm")
36+
37+
18:
38+
$(call build-image,"17","3","bookworm")

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ This image extends the [official PostgreSQL image](https://hub.docker.com/_/post
88
- [pgRouting](http://pgrouting.org/)
99
- [PostgreSQL contrib package](https://packages.debian.org/sid/postgresql-contrib-9.6)
1010
- [Wal-g backup tools](https://github.com/wal-g/wal-g)
11+
- [pgvector 0.8.1](https://github.com/pgvector/pgvector)
1112

1213
See the PostgreSQL image documentation for more details:
1314
https://hub.docker.com/_/postgres/

0 commit comments

Comments
 (0)