services: postgres: image: postgres:alpine environment: POSTGRES_DB: ${POSTGRES_DB:?Set POSTGRES_DB in the root .env file} POSTGRES_USER: ${POSTGRES_USER:?Set POSTGRES_USER in the root .env file} POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:?Set POSTGRES_PASSWORD in the root .env file} POSTGRES_EXPORTER_USER: ${POSTGRES_EXPORTER_USER:-} POSTGRES_EXPORTER_PASSWORD: ${POSTGRES_EXPORTER_PASSWORD:-} volumes: - postgres_data:/var/lib/postgresql - ./initdb/10-postgres-exporter.sh:/docker-entrypoint-initdb.d/10-postgres-exporter.sh:ro healthcheck: test: ["CMD-SHELL", "pg_isready -U \"$${POSTGRES_USER}\" -d \"$${POSTGRES_DB}\""] interval: 10s timeout: 5s retries: 5 start_period: 20s restart: unless-stopped logging: driver: json-file options: max-size: 10m max-file: "3" deploy: resources: limits: cpus: "1.0" memory: 2G backend: build: context: ../../backend dockerfile: Dockerfile environment: DATABASE_URL: postgres://${POSTGRES_USER:?Set POSTGRES_USER}:${POSTGRES_PASSWORD:?Set POSTGRES_PASSWORD}@postgres:5432/${POSTGRES_DB:?Set POSTGRES_DB}?sslmode=disable depends_on: postgres: condition: service_healthy expose: - "8080" - "9090" restart: unless-stopped logging: driver: json-file options: max-size: 10m max-file: "3" deploy: resources: limits: cpus: "1.0" memory: 768M frontend: build: context: ../.. dockerfile: frontend/Dockerfile depends_on: backend: condition: service_started ports: - "127.0.0.1:${APP_HTTP_PORT:-8080}:8080" healthcheck: test: ["CMD", "wget", "-q", "-O", "/dev/null", "http://127.0.0.1:8080/healthz"] interval: 10s timeout: 3s retries: 5 start_period: 5s restart: unless-stopped logging: driver: json-file options: max-size: 10m max-file: "3" deploy: resources: limits: cpus: "0.5" memory: 256M volumes: postgres_data: name: ${APP_PROJECT:-app}_postgres_data networks: default: name: ${APP_NETWORK:-app_default}