feat: restructure PostgreSQL setup with base variant

This commit is contained in:
2026-03-08 18:11:18 +07:00
parent a3610d6756
commit d490100860
6 changed files with 52 additions and 70 deletions

View File

@@ -0,0 +1,4 @@
POSTGRES_USER=postgres
POSTGRES_PASSWORD=postgres
POSTGRES_DB=postgres
POSTGRES_PORT=5432

View File

@@ -0,0 +1,3 @@
CREATE EXTENSION IF NOT EXISTS citext;
CREATE EXTENSION IF NOT EXISTS pg_trgm;
CREATE EXTENSION IF NOT EXISTS pgcrypto;

6
postgres-base/Dockerfile Normal file
View File

@@ -0,0 +1,6 @@
FROM postgres:18-alpine
COPY 000_extensions.sql /docker-entrypoint-initdb.d/
HEALTHCHECK --interval=10s --timeout=5s --retries=5 \
CMD pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}

16
postgres-base/compose.yml Normal file
View File

@@ -0,0 +1,16 @@
services:
postgres:
# run `just build postgres` first
image: db-postgres:latest
restart: unless-stopped
environment:
POSTGRES_USER: ${POSTGRES_USER:-postgres}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-postgres}
POSTGRES_DB: ${POSTGRES_DB:-postgres}
ports:
- "${POSTGRES_PORT:-5432}:5432"
volumes:
- postgres-data:/var/lib/postgresql
volumes:
postgres-data: