Add pgAdmin to the peo4c image

Install pgAdmin 9.18 in its own virtualenv and run it under gunicorn on
port 5050 next to PostgreSQL and the bridge. On first start the
entrypoint creates the pgAdmin login (PGADMIN_DEFAULT_EMAIL, default
admin@example.com; PGADMIN_DEFAULT_PASSWORD, default POSTGRES_PASSWORD)
and registers the bundled PostgreSQL server. pgAdmin is optional
(PEO4C_PGADMIN=false) and a failure in it does not stop the container.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Bart BroereandClaude Opus 5.5 committed 2026-10-14 11:19:58 +02:00
1 parent 47b8f5f746
commit e72af59401
4 files changed
+98 -20

No files matched your search

+19 -5
View File
@@ -3,9 +3,10 @@
# Stage 1 builds the neo4j-browser static frontend from source.
# Stage 2 is the Apache AGE image (PostgreSQL with the AGE extension) plus the
# peo4c bridge, which speaks the Bolt protocol to the browser and translates
# Cypher into AGE `cypher()` calls.
# Cypher into AGE `cypher()` calls, and pgAdmin as a SQL interface.
ARG AGE_IMAGE=docker.io/apache/age:release_PG18_1.8.0
ARG PGADMIN_VERSION=9.18
FROM docker.io/library/node:16.20.2-bullseye AS browser
@@ -23,13 +24,23 @@ RUN yarn build && test -f dist/index.html
FROM ${AGE_IMAGE}
ARG PGADMIN_VERSION
RUN apt-get update \
&& apt-get install -y --no-install-recommends python3 python3-psycopg \
&& apt-get install -y --no-install-recommends python3 python3-psycopg python3-venv \
&& rm -rf /var/lib/apt/lists/*
RUN python3 -m venv /opt/pgadmin \
&& /opt/pgadmin/bin/pip install --no-cache-dir "pgadmin4==${PGADMIN_VERSION}" gunicorn \
&& ln -s "$(/opt/pgadmin/bin/python -c 'import sysconfig; print(sysconfig.get_paths()["purelib"])')/pgadmin4" \
/opt/pgadmin/app \
&& mkdir -p /var/lib/pgadmin \
&& chown postgres:postgres /var/lib/pgadmin
COPY --from=browser /src/dist /opt/peo4c/browser
COPY bridge /opt/peo4c/bridge
COPY docker/initdb/ /docker-entrypoint-initdb.d/
COPY docker/pgadmin/config_distro.py /opt/peo4c/pgadmin/config_distro.py
COPY docker/peo4c-entrypoint.sh /usr/local/bin/peo4c-entrypoint.sh
ENV PEO4C_DEFAULT_GRAPH=neo4j \
@@ -37,10 +48,13 @@ ENV PEO4C_DEFAULT_GRAPH=neo4j \
PEO4C_HTTP_PORT=7474 \
PEO4C_BOLT_PORT=7687 \
PEO4C_PG_HOST=127.0.0.1 \
PEO4C_PG_PORT=5432
PEO4C_PG_PORT=5432 \
PEO4C_PGADMIN=true \
PEO4C_PGADMIN_PORT=5050 \
CONFIG_DISTRO_FILE_PATH=/opt/peo4c/pgadmin/config_distro.py
# 7474: neo4j-browser (HTTP), 7687: Bolt, 5432: PostgreSQL
EXPOSE 7474 7687 5432
# 7474: neo4j-browser (HTTP), 7687: Bolt, 5050: pgAdmin, 5432: PostgreSQL
EXPOSE 7474 7687 5050 5432
ENTRYPOINT ["/usr/local/bin/peo4c-entrypoint.sh"]
CMD ["postgres", "-c", "shared_preload_libraries=age"]