Files
postgres-ts-vectors/Dockerfile
T
maxime.killinger dcf4169d3d
🚀 Docker Build and Push / build-and-push (16) (push) Successful in 16m11s
🚀 Docker Build and Push / build-and-push (15) (push) Successful in 16m26s
🚀 Docker Build and Push / build-and-push (17) (push) Successful in 11m7s
feat(docker): add PostGIS and remove unstable PG18 support
- Install PostGIS (postgresql--postgis-3) in the final image.

- Add postgis and postgis_topology to init-extensions.sh.

- Add test script for PostGIS to the CI workflow.

- Update README.md to reflect PostGIS integration.

- Remove PG18 from CI matrix because of ABI incompatibility between TimescaleDB headers and the vchord-postgres PG18 runtime (missing palloc0_mul). PG18 support will be restored when VectorChord releases a stable PG18 image.
2026-08-03 18:14:08 +02:00

71 lines
2.9 KiB
Docker

# syntax=docker/dockerfile:1
ARG PG_VERSION=18
# =============================================================================
# Builder stage - Compile TimescaleDB
# =============================================================================
FROM tensorchord/vchord-postgres:pg${PG_VERSION}-v1.1.1 AS builder
USER root
# Install build dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
git \
build-essential \
cmake \
libssl-dev \
libkrb5-dev \
postgresql-server-dev-$PG_MAJOR \
&& rm -rf /var/lib/apt/lists/*
# Build TimescaleDB from source (stable release)
ARG TIMESCALEDB_VERSION=2.28.3
WORKDIR /build/timescaledb
RUN git clone --branch ${TIMESCALEDB_VERSION} --depth 1 https://github.com/timescale/timescaledb.git . \
&& ./bootstrap -DREGRESS_CHECKS=OFF -DWARNINGS_AS_ERRORS=OFF \
&& cd build && make -j$(nproc) && make install DESTDIR=/tmp/timescaledb
# =============================================================================
# Final stage - Clean runtime image
# =============================================================================
FROM tensorchord/vchord-postgres:pg${PG_VERSION}-v1.1.1 AS final
# OCI Labels
LABEL org.opencontainers.image.title="TimescaleDB + VectorChord + pgvector + PostGIS"
LABEL org.opencontainers.image.description="PostgreSQL with TimescaleDB, VectorChord, pgvector, and PostGIS extensions pre-installed"
LABEL org.opencontainers.image.source="https://gitea.killinger.fr/maxime.killinger/postgres-ts-vectors"
LABEL org.opencontainers.image.vendor="Maxime Killinger"
LABEL org.opencontainers.image.licenses="Apache-2.0"
LABEL org.opencontainers.image.base.name="tensorchord/vchord-postgres:pg${PG_VERSION}-v1.1.1"
# Copy TimescaleDB from builder
COPY --from=builder /tmp/timescaledb/usr/lib/postgresql/ /usr/lib/postgresql/
COPY --from=builder /tmp/timescaledb/usr/share/postgresql/ /usr/share/postgresql/
USER root
# Install PostGIS
RUN apt-get update && apt-get install -y --no-install-recommends \
postgresql-$PG_MAJOR-postgis-3 \
postgresql-$PG_MAJOR-postgis-3-scripts \
postgis \
&& rm -rf /var/lib/apt/lists/*
# Add init script for auto-extension creation
COPY init-extensions.sh /docker-entrypoint-initdb.d/
RUN sed -i 's/\r$//' /docker-entrypoint-initdb.d/init-extensions.sh && \
chmod +x /docker-entrypoint-initdb.d/init-extensions.sh
# Add entrypoint wrapper to fix volume permissions at runtime
COPY docker-entrypoint-wrapper.sh /usr/local/bin/
RUN sed -i 's/\r$//' /usr/local/bin/docker-entrypoint-wrapper.sh && \
chmod +x /usr/local/bin/docker-entrypoint-wrapper.sh
# Healthcheck
HEALTHCHECK --interval=30s --timeout=5s --start-period=60s --retries=3 \
CMD pg_isready -U postgres || exit 1
# Run as root initially, wrapper will fix permissions then switch to postgres
ENTRYPOINT ["docker-entrypoint-wrapper.sh"]
CMD ["postgres", "-c", "shared_preload_libraries=timescaledb,vchord"]