2023-11-27 10:55:19 +00:00
|
|
|
ARG CNPG_TAG
|
2023-11-26 14:24:06 +00:00
|
|
|
|
2023-12-16 18:52:42 +01:00
|
|
|
FROM ghcr.io/cloudnative-pg/postgresql:$CNPG_TAG
|
2023-11-26 14:24:06 +00:00
|
|
|
|
2023-11-27 11:56:23 +00:00
|
|
|
ARG CNPG_TAG
|
2025-07-09 16:54:39 +07:00
|
|
|
ARG VECTORCHORD_TAG
|
2023-11-27 10:48:15 +00:00
|
|
|
ARG PGVECTORS_TAG
|
2023-12-16 17:42:48 +01:00
|
|
|
ARG TARGETARCH
|
2023-11-27 11:54:30 +00:00
|
|
|
|
2023-11-26 16:51:11 +00:00
|
|
|
# drop to root to install packages
|
|
|
|
|
USER root
|
2023-11-26 14:24:06 +00:00
|
|
|
|
2025-07-09 17:49:17 +07:00
|
|
|
RUN apt update && apt install -y curl wget
|
2023-11-26 14:24:06 +00:00
|
|
|
|
2025-07-09 17:49:17 +07:00
|
|
|
# Extract PostgreSQL major version from CNPG_TAG (handles formats like "17.5-bookworm" -> "17")
|
|
|
|
|
RUN PG_MAJOR=$(echo $CNPG_TAG | cut -d'-' -f1 | cut -d'.' -f1) && \
|
2025-07-10 19:22:13 +07:00
|
|
|
VERSION_NUM=${PGVECTORS_TAG#"v"} && \
|
|
|
|
|
if [ "$PG_MAJOR" = "17" ] && [ "$VERSION_NUM" = "0.3.0" ]; then \
|
|
|
|
|
# Special case for PG17 with v0.3.0 - use vectors variant
|
2025-07-10 19:45:38 +07:00
|
|
|
curl -L -o ./pgvectors.deb "https://github.com/tensorchord/pgvecto.rs/releases/download/v$PGVECTORS_TAG/vectors-pg${PG_MAJOR}_${VERSION_NUM}_${TARGETARCH}_vectors.deb"; \
|
2025-07-10 19:22:13 +07:00
|
|
|
else \
|
|
|
|
|
# Standard naming for other versions
|
2025-07-10 19:45:38 +07:00
|
|
|
curl -L -o ./pgvectors.deb "https://github.com/tensorchord/pgvecto.rs/releases/download/v$PGVECTORS_TAG/vectors-pg${PG_MAJOR}_${VERSION_NUM}_$TARGETARCH.deb"; \
|
2025-07-10 19:22:13 +07:00
|
|
|
fi && \
|
2025-07-09 17:49:17 +07:00
|
|
|
apt install -y ./pgvectors.deb && \
|
|
|
|
|
rm -f ./pgvectors.deb
|
|
|
|
|
|
|
|
|
|
RUN PG_MAJOR=$(echo $CNPG_TAG | cut -d'-' -f1 | cut -d'.' -f1) && \
|
|
|
|
|
curl -L -o ./vchord.deb "https://github.com/tensorchord/VectorChord/releases/download/$VECTORCHORD_TAG/postgresql-${PG_MAJOR}-vchord_${VECTORCHORD_TAG}-1_$TARGETARCH.deb" && \
|
|
|
|
|
apt install -y ./vchord.deb && \
|
|
|
|
|
rm -f ./vchord.deb
|
|
|
|
|
|
|
|
|
|
# go back to postgres user
|
2025-07-09 16:54:39 +07:00
|
|
|
USER postgres
|