Kursach: add portable PostgreSQL database setup (salon-is)

This commit is contained in:
2026-11-27 11:53:18 +03:00
parent 1ac485fad1
commit 975349d40a
8 changed files with 1252 additions and 0 deletions
+41
View File
@@ -0,0 +1,41 @@
services:
db:
image: postgres:16
container_name: salon_is_db
restart: unless-stopped
environment:
POSTGRES_DB: ${POSTGRES_DB:-salon}
POSTGRES_USER: ${POSTGRES_USER:-postgres}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-change-me}
# Allows password connections from other machines on the LAN.
POSTGRES_HOST_AUTH_METHOD: scram-sha-256
# Guarantees correct Russian text in the init script.
PGCLIENTENCODING: UTF8
TZ: Europe/Moscow
ports:
- "${DB_PORT:-5433}:5432"
volumes:
- pgdata:/var/lib/postgresql/data
- ./sql:/docker-entrypoint-initdb.d:ro
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-postgres} -d ${POSTGRES_DB:-salon}"]
interval: 5s
timeout: 3s
retries: 20
pgadmin:
image: dpage/pgadmin4:latest
container_name: salon_is_pgadmin
profiles: ["pgadmin"]
restart: unless-stopped
environment:
PGADMIN_DEFAULT_EMAIL: ${PGADMIN_EMAIL:-admin@admin.com}
PGADMIN_DEFAULT_PASSWORD: ${PGADMIN_PASSWORD:-admin}
ports:
- "${PGADMIN_PORT:-5050}:80"
depends_on:
db:
condition: service_healthy
volumes:
pgdata: