Dockerfile.postgres 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. # Build stage: compile Apache AGE against PostgreSQL 18 on top of pgvector
  2. FROM pgvector/pgvector:pg18-trixie AS build
  3. RUN apt-get update \
  4. && apt-get install -y --no-install-recommends --no-install-suggests \
  5. ca-certificates \
  6. git \
  7. bison \
  8. build-essential \
  9. flex \
  10. postgresql-server-dev-18
  11. RUN git clone --depth 1 --branch release/PG18/1.7.0 https://github.com/apache/age.git /usr/src/age \
  12. && cd /usr/src/age \
  13. && make \
  14. && make install
  15. # Final stage: Create a final image by copying the files created in the build stage
  16. FROM pgvector/pgvector:pg18-trixie
  17. RUN apt-get update \
  18. && apt-get install -y --no-install-recommends --no-install-suggests \
  19. locales
  20. RUN echo "en_US.UTF-8 UTF-8" > /etc/locale.gen \
  21. && locale-gen \
  22. && update-locale LANG=en_US.UTF-8
  23. ENV LANG=en_US.UTF-8
  24. ENV LC_COLLATE=en_US.UTF-8
  25. ENV LC_CTYPE=en_US.UTF-8
  26. COPY --from=build /usr/lib/postgresql/18/lib/age.so /usr/lib/postgresql/18/lib/
  27. COPY --from=build /usr/share/postgresql/18/extension/age--1.7.0.sql /usr/share/postgresql/18/extension/
  28. COPY --from=build /usr/share/postgresql/18/extension/age.control /usr/share/postgresql/18/extension/
  29. RUN printf '%s\n' \
  30. 'CREATE EXTENSION IF NOT EXISTS vector;' \
  31. 'CREATE EXTENSION IF NOT EXISTS age CASCADE;' \
  32. > /docker-entrypoint-initdb.d/00-create-extensions.sql
  33. # Note: AGE extension require to be loaded shared_preload_libraries
  34. CMD ["postgres", "-c", "shared_preload_libraries=age"]