# =============================================================================
# Caddy configuration (add to your Caddy instance's Caddyfile):
#
#   your-domain.example.com {
#       root * /path/on/caddy/host/to/pp-planer/public
#       php_fastcgi pp-planer-app:9000 {
#           root /app/public
#       }
#       file_server
#       encode gzip
#   }
#
# Notes:
# - "root *" = path on the Caddy HOST to the bind-mounted ./public directory
# - "root /app/public" inside php_fastcgi = path INSIDE this container
# - "pp-planer-app" resolves via the shared "caddy" Docker network
# - Both Caddy and this container must be on the "caddy" external network
# - The ./public directory is bind-mounted so Caddy can serve static files
# =============================================================================

services:
  app:
    build:
      context: .
      dockerfile: build/Dockerfile
    container_name: pp-planer-app
    restart: unless-stopped
    volumes:
      - ./.env:/app/.env:ro
      - ./storage:/app/storage
      - ./database:/app/database
      - ./public:/app/public
    expose:
      - "9000"
    networks:
      - caddy
      - internal

  # mysql:
  #   image: mysql:8.0
  #   container_name: pp-planer-mysql
  #   restart: unless-stopped
  #   environment:
  #     MYSQL_DATABASE: ${DB_DATABASE:-pp_planer}
  #     MYSQL_ROOT_PASSWORD: ${DB_PASSWORD}
  #     MYSQL_PASSWORD: ${DB_PASSWORD}
  #     MYSQL_USER: ${DB_USERNAME}
  #   volumes:
  #     - mysql_data:/var/lib/mysql
  #   networks:
  #     - internal

# volumes:
#   mysql_data:

networks:
  caddy:
    external: true
  internal:
    driver: bridge
