Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,12 @@ jobs:
CREATE EXTENSION postgis_tiger_geocoder CASCADE;
CREATE EXTENSION vector;
CREATE EXTENSION pg_trgm;
CREATE EXTENSION hypopg;
CREATE EXTENSION pg_stat_statements;
SELECT extname, extversion FROM pg_extension ORDER BY extname;
SELECT '[1,2,3]'::vector <=> '[1,2,4]'::vector AS cosine_distance, ST_AsText(ST_MakePoint(24.57, 59.34)) AS point;"
SELECT '[1,2,3]'::vector <=> '[1,2,4]'::vector AS cosine_distance, ST_AsText(ST_MakePoint(24.57, 59.34)) AS point;
SELECT indexname AS hypothetical_index FROM hypopg_create_index('CREATE INDEX ON pg_class (relname)');
SELECT count(*) > 0 AS statements_tracked FROM pg_stat_statements;"
- uses: docker/metadata-action@v6
id: meta
with:
Expand Down
7 changes: 6 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# PostgreSQL 18 with PostGIS 3 and pgvector. The official postgres image is multi-architecture
# PostgreSQL 18 with PostGIS 3, pgvector and hypopg. The official postgres image is multi-architecture
# (x86 and Arm) and Debian-based, with the PostgreSQL project's apt repository configured, whose
# extension packages follow each release.
FROM postgres:18-trixie
Expand All @@ -8,4 +8,9 @@ RUN apt-get update \
postgresql-18-postgis-3 \
postgresql-18-postgis-3-scripts \
postgresql-18-pgvector \
postgresql-18-hypopg \
&& rm -rf /var/lib/apt/lists/*

# pg_stat_statements (statistics per query) works only when loaded at startup. A project that sets
# its own command or shared_preload_libraries replaces this and adds it to its own list.
CMD ["postgres", "-c", "shared_preload_libraries=pg_stat_statements"]
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# digib/postgres

PostgreSQL 18 with PostGIS 3 and pgvector, the same image locally, in CI and deployed.
PostgreSQL 18 with PostGIS 3, pgvector and hypopg, the same image locally, in CI and deployed.

```bash
docker pull ghcr.io/digib/postgres:18
Expand All @@ -11,7 +11,8 @@ docker pull ghcr.io/digib/postgres:18
- **[PostgreSQL 18](https://hub.docker.com/_/postgres)**, from the official `postgres:18-trixie` image: Debian, for x86 and Arm
- **[PostGIS 3](https://postgis.net/)**, with its topology and Tiger geocoder extensions (`postgresql-18-postgis-3`, `postgresql-18-postgis-3-scripts`)
- **[pgvector](https://github.com/pgvector/pgvector)** (`postgresql-18-pgvector`)
- PostgreSQL's own extensions, such as `pg_trgm` and `fuzzystrmatch`
- **[hypopg](https://hypopg.readthedocs.io/)** (`postgresql-18-hypopg`): hypothetical indexes, to see what an index would do without building it
- PostgreSQL's own extensions, such as `pg_trgm`, `fuzzystrmatch` and `pg_stat_statements` (statistics per query), which the image loads at startup (`shared_preload_libraries`). A project that sets its own `command` or `shared_preload_libraries` replaces that and adds `pg_stat_statements` to its own list.

Extensions come from the PostgreSQL project's apt repository, which follows each release. A project creates the ones it uses, in a migration or an init script:

Expand Down
Loading