prole/prole-db/Dockerfile
chrisfu 906392d462 feat(installer): improve UI and add test coverage for core features
- Refactored installer UI with updated canvas rendering, sidebar navigation, and footer buttons.
- Enhanced styling for macOS compatibility and consistent design across controls.
- Added Pytest-based unit tests for `screen.py` and `config.py`.
- Expanded dependency catalog with new tools like `tshark` and `pyshark`.
- Improved error tolerance for background rendering and added placeholders for Kerberos configuration.
2026-01-08 21:51:30 -08:00

142 lines
5.6 KiB
Docker
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

FROM ubuntu:24.04
ENV DEBIAN_FRONTEND=noninteractive
ENV LANG=C.UTF-8
# Official image expects PGDATA default to /var/lib/postgresql/data
ENV PGDATA=/var/lib/postgresql/data
# 1) Base runtime deps to match official behavior (gosu, locales, etc.)
RUN set -eux; \
apt-get update; \
apt-get install -y --no-install-recommends \
ca-certificates curl wget gnupg2 lsb-release \
locales tzdata \
gosu \
build-essential git \
; \
rm -rf /var/lib/apt/lists/*; \
locale-gen en_US.UTF-8
# 2) Add Percona apt repo + install Percona Server for PostgreSQL 17
# Percona docs: use percona-release + setup ppg-17, and avoid mixing with distro postgresql-17
RUN set -eux; \
apt-get update; \
wget -q "https://repo.percona.com/apt/percona-release_latest.$(lsb_release -sc)_all.deb"; \
dpkg -i "percona-release_latest.$(lsb_release -sc)_all.deb"; \
rm -f "percona-release_latest.$(lsb_release -sc)_all.deb"; \
apt-get update; \
percona-release setup ppg-17; \
apt-get update; \
apt-get install -y --no-install-recommends \
percona-postgresql-17 \
; \
rm -rf /var/lib/apt/lists/*
# install nfs & iscsi
# RUN apt-get install -y nfs-common
# RUN apt-get install -y open-iscsi
# Ensure postgres binaries are on PATH (official entrypoint expects `postgres`, `initdb`, `psql` in PATH)
# Perconas deb layout is Debian-like; this is the common bindir.
ENV PATH=/usr/lib/postgresql/17/bin:$PATH
# 3) Install dev headers for PGXS builds
RUN set -eux; \
apt-get update; \
apt-cache search percona-postgresql | grep -i dev; \
apt-get install -y --no-install-recommends percona-postgresql-server-dev-17; \
rm -rf /var/lib/apt/lists/*
# 4) Create postgres user + dirs similar to official image expectations
RUN set -eux; \
groupadd -r postgres --gid=999 || true; \
useradd -r -g postgres --uid=999 --home-dir=/var/lib/postgresql --shell=/bin/bash postgres || true; \
mkdir -p /var/lib/postgresql /var/run/postgresql "$PGDATA" /docker-entrypoint-initdb.d; \
chown -R postgres:postgres /var/lib/postgresql /var/run/postgresql /docker-entrypoint-initdb.d; \
chmod 3777 /var/run/postgresql
# 5) Build and install pg_prolelog module + PostgreSQL extensions
# Install dependencies for building pg_prolelog and other extensions
RUN set -eux; \
apt-get update; \
apt-get install -y --no-install-recommends \
cmake \
libssl-dev \
libkrb5-dev \
libgdal-dev \
libproj-dev \
libgeos-dev \
libxml2-dev \
libjson-c-dev \
libprotobuf-c-dev \
protobuf-c-compiler \
; \
rm -rf /var/lib/apt/lists/*
# Copy and build pg_prolelog from local directory
COPY pg_prolelog /tmp/pg_prolelog
COPY pg_prolelog.Makefile /tmp/pg_prolelog/Makefile
RUN set -eux; \
cd /tmp/pg_prolelog; \
make; \
make install; \
cd /; \
rm -rf /tmp/pg_prolelog
# Install PostgreSQL extensions
RUN set -eux; \
apt-get update; \
apt-cache search percona-postgresql-17 | grep -E "(pgvector|postgis|contrib)"; \
apt-get install -y --no-install-recommends \
percona-postgresql-17-pgvector \
percona-postgresql-17-postgis-3 \
percona-postgresql-contrib-17 \
freetds-dev \
; \
rm -rf /var/lib/apt/lists/*
# Build and install tds_fdw
RUN set -eux; \
cd /tmp; \
git clone https://github.com/tds-fdw/tds_fdw.git; \
cd tds_fdw; \
make USE_PGXS=1; \
make USE_PGXS=1 install; \
cd /; \
rm -rf /tmp/tds_fdw
# Create extension registration script
RUN set -eux; \
echo "#!/bin/bash" > /docker-entrypoint-initdb.d/20_create_extensions.sh; \
echo "set -e" >> /docker-entrypoint-initdb.d/20_create_extensions.sh; \
echo 'psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" <<-EOSQL' >> /docker-entrypoint-initdb.d/20_create_extensions.sh; \
echo " CREATE EXTENSION IF NOT EXISTS vector;" >> /docker-entrypoint-initdb.d/20_create_extensions.sh; \
echo " CREATE EXTENSION IF NOT EXISTS pgcrypto;" >> /docker-entrypoint-initdb.d/20_create_extensions.sh; \
echo " CREATE EXTENSION IF NOT EXISTS tds_fdw;" >> /docker-entrypoint-initdb.d/20_create_extensions.sh; \
echo " CREATE EXTENSION IF NOT EXISTS postgis;" >> /docker-entrypoint-initdb.d/20_create_extensions.sh; \
echo " CREATE EXTENSION IF NOT EXISTS postgis_topology;" >> /docker-entrypoint-initdb.d/20_create_extensions.sh; \
echo " CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder;" >> /docker-entrypoint-initdb.d/20_create_extensions.sh; \
echo " CREATE EXTENSION IF NOT EXISTS pg_prolelog;" >> /docker-entrypoint-initdb.d/20_create_extensions.sh; \
echo "EOSQL" >> /docker-entrypoint-initdb.d/20_create_extensions.sh; \
chmod +x /docker-entrypoint-initdb.d/20_create_extensions.sh
# Install barman-cloud
COPY requirements.txt /
RUN set -xe; apt-get update; apt-get install -y --no-install-recommends build-essential python3-dev python3-pip python3-psycopg2 python3-setuptools
RUN pip3 install --break-system-packages -r /requirements.txt
RUN apt-get remove -y --purge --autoremove build-essential python3-dev && rm -rf /var/lib/apt/lists/*
# 6) Add entrypoint scripts (official entrypoint verbatim + our tiny wrapper + OpenBao/pg_tde init hook)
COPY docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh
COPY prole-db-entrypoint.sh /usr/local/bin/prole-entrypoint.sh
COPY 10_pg_tde_openbao.sh /docker-entrypoint-initdb.d/10_pg_tde_openbao.sh
# staged copies of the pgdata/*.conf files
COPY postgresql/*.conf /etc/postgresql/17/main/
RUN chown postgres:postgres /etc/postgresql/17/main/*.conf
RUN set -eux; \
chmod +x /usr/local/bin/docker-entrypoint.sh /usr/local/bin/prole-entrypoint.sh /docker-entrypoint-initdb.d/10_pg_tde_openbao.sh
EXPOSE 5432
CMD ["postgres"]