# Postgres 17 + pgvector.
# Base image is the official docker.io/postgres:17; pgvector is compiled in
# at build time so the app gets native `vector` type + cosine (`<=>`) search.
FROM docker.io/postgres:17

ARG PGVECTOR_VERSION=v0.8.0

RUN apt-get update \
    && apt-get install -y --no-install-recommends \
         build-essential git ca-certificates postgresql-server-dev-17 \
    && git clone --branch ${PGVECTOR_VERSION} --depth 1 https://github.com/pgvector/pgvector.git /tmp/pgvector \
    && make -C /tmp/pgvector \
    && make -C /tmp/pgvector install \
    && rm -rf /tmp/pgvector \
    && apt-get purge -y --auto-remove -qq \
         build-essential git ca-certificates postgresql-server-dev-17 \
    && rm -rf /var/lib/apt/lists/*

EXPOSE 5432
