services:
  db:
    image: postgres:16
    container_name: lub_db
    environment:
      POSTGRES_USER: app
      POSTGRES_PASSWORD: secret
      POSTGRES_DB: appdb
    ports:
      - "15432:5432"  # ← Außen 15432 statt 5432
    volumes:
      - pgdata:/var/lib/postgresql/data
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U app -d appdb"]
      interval: 5s
      timeout: 3s
      retries: 10
    restart: unless-stopped

  backend:
    build:
      context: .
      dockerfile: Dockerfile.backend
    container_name: lub_backend
    ports:
      - "13000:3000"  # ← Außen 13000 statt 3000
    env_file:
      - ./apps/backend/.env.production
    depends_on:
      db:
        condition: service_healthy
    restart: unless-stopped

  frontend:
    build:
      context: .
      dockerfile: Dockerfile.frontend
    container_name: lub_frontend
    ports:
      - "1111:80"  # ← Außen 1111 statt 80 (DAS WILLST DU!)
    volumes:
      - ./apps/frontend/public/config.production.json:/usr/share/nginx/html/config.json:ro
    depends_on:
      - backend
    restart: unless-stopped

volumes:
  pgdata: