Files
Business-Management/docker-compose.yml
T
curo1305 a5baef73d9 Implement rootless containers for all services
- backend: appuser UID/GID 1001 via useradd, USER directive, --chown on COPY
- frontend builder: appuser UID/GID 1001 via adduser, USER directive
- frontend prod: switch to nginxinc/nginx-unprivileged:alpine (nginx UID 101), listen on 8080
- docker-compose: explicit user: for all services (70:70 db, 1001:1001 backend/frontend-dev, 101:101 frontend-prod)
- nginx.conf: listen 8080 to match unprivileged image

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-13 17:18:02 +02:00

54 lines
1.8 KiB
YAML

services:
# ── Database ────────────────────────────────────────────────────────────────
db:
image: postgres:16-alpine
user: "70:70" # postgres user UID:GID in alpine image (fixed by image)
restart: unless-stopped
environment:
POSTGRES_USER: ${POSTGRES_USER:-postgres}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-password}
POSTGRES_DB: ${POSTGRES_DB:-destroying_sap}
ports:
- "5432:5432"
volumes:
- postgres_data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-postgres}"]
interval: 5s
timeout: 5s
retries: 10
# ── Backend (management) ────────────────────────────────────────────────────
backend:
build:
context: ./backend
dockerfile: Dockerfile
network: host
user: "1001:1001"
restart: unless-stopped
env_file: ./backend/.env
environment:
DATABASE_URL: postgresql+asyncpg://${POSTGRES_USER:-postgres}:${POSTGRES_PASSWORD:-password}@db:5432/${POSTGRES_DB:-destroying_sap}
ports:
- "8000:8000"
depends_on:
db:
condition: service_healthy
# ── Frontend (UI) ────────────────────────────────────────────────────────────
frontend:
build:
context: ./frontend
dockerfile: Dockerfile
network: host
user: "101:101" # nginx user UID:GID in nginx-unprivileged:alpine
restart: unless-stopped
ports:
- "80:8080"
depends_on:
- backend
volumes:
postgres_data: