version: '3.8' services: postgres: container_name: postgres image: postgres:15-alpine restart: unless-stopped volumes: - ./.volumes/postgres:/var/lib/postgresql/data environment: - PGUSER=${DB_USER} - POSTGRES_USER=${DB_USER} - POSTGRES_PASSWORD=${DB_PASS} - POSTGRES_DB=${DB_NAME} ports: - 5432:5432 deploy: resources: limits: cpus: '0.5' memory: 512M healthcheck: test: ["CMD", "pg_isready", "-U", "${POSTGRES_USER}"] interval: 1m timeout: 10s retries: 3 start_period: 40s security_opt: - no-new-privileges:true