version: "3.8"

services:
  lpk-app:
    build: .
    container_name: lpk-app
    restart: unless-stopped
    env_file:
      - .env
    environment:
      - APP_ENV=production
      - APP_DEBUG=false
      - DB_HOST=db
      - DB_DATABASE=${DB_DATABASE:-lpk}
      - DB_USERNAME=${DB_USERNAME:-lpk}
      - DB_PASSWORD=${DB_PASSWORD:-lpk_secret}
    volumes:
      - lpk_storage:/var/www/html/storage
    depends_on:
      - db
    networks: [lpk-net]

  lpk-nginx:
    image: nginx:1.27-alpine
    container_name: lpk-nginx
    restart: unless-stopped
    ports:
      - "8081:80"   # 8080 sudah dipakai mfa-orchestrator-api
    volumes:
      - ./docker/nginx/lpk.conf:/etc/nginx/conf.d/default.conf:ro
      - ./public:/var/www/html/public:ro
    depends_on:
      - lpk-app
    networks: [lpk-net]

  db:
    image: mariadb:10.11
    container_name: lpk-db
    restart: unless-stopped
    environment:
      - MARIADB_DATABASE=${DB_DATABASE:-lpk}
      - MARIADB_USER=${DB_USERNAME:-lpk}
      - MARIADB_PASSWORD=${DB_PASSWORD:-lpk_secret}
      - MARIADB_ROOT_PASSWORD=${DB_ROOT_PASSWORD:-root_secret}
    volumes:
      - db_data:/var/lib/mysql
    networks: [lpk-net]

  # (Opsional) Face service — aktifkan bila FACE_SERVICE_URL dipakai
  # face-service:
  #   build: ./face_service
  #   container_name: lpk-face
  #   restart: unless-stopped
  #   ports:
  #     - "8001:8001"
  #   networks: [lpk-net]

volumes:
  lpk_storage:
  db_data:

networks:
  lpk-net:
    driver: bridge
