# Sublarr — PostgreSQL stack # # Usage: # docker compose -f docker-compose.postgres.yml up -d # # On first run Postgres initialises an empty database. Sublarr runs Alembic # migrations automatically on startup so no manual schema setup is needed. # # To migrate an existing SQLite database see docs/POSTGRESQL.md. services: postgres: image: postgres:16-alpine container_name: sublarr-postgres environment: POSTGRES_DB: sublarr POSTGRES_USER: sublarr POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:?POSTGRES_PASSWORD is required} volumes: - postgres_data:/var/lib/postgresql/data healthcheck: test: ["CMD-SHELL", "pg_isready -U sublarr -d sublarr"] interval: 10s timeout: 5s retries: 5 start_period: 30s restart: unless-stopped security_opt: - no-new-privileges:true sublarr: image: ghcr.io/abrechen2/sublarr:${VERSION:-latest} build: context: . args: VERSION: ${VERSION:-dev} PUID: ${PUID:-1000} PGID: ${PGID:-1000} container_name: sublarr depends_on: postgres: condition: service_healthy ports: - "127.0.0.1:${SUBLARR_PORT:-5765}:5765" volumes: - ./config:/config - ${SUBLARR_MEDIA_PATH:-/media}:/media:rw environment: SUBLARR_DATABASE_URL: postgresql://sublarr:${POSTGRES_PASSWORD}@postgres/sublarr read_only: true tmpfs: - /tmp restart: unless-stopped deploy: resources: limits: cpus: '2.0' memory: 4G reservations: cpus: '0.5' memory: 512M security_opt: - no-new-privileges:true cap_drop: - ALL cap_add: - CHOWN - DAC_OVERRIDE logging: driver: "json-file" options: max-size: "10m" max-file: "3" volumes: postgres_data: