# Production Docker Compose für Stargirlnails Kiel
# Mit Nginx Reverse Proxy und Let's Encrypt SSL-Zertifikaten

services:
  # Hauptanwendung
  stargirlnails:
    build: .
    container_name: stargirlnails-app
    env_file:
      - .env
    environment:
      - NODE_ENV=production
      - DISABLE_DUPLICATE_CHECK=false
    restart: unless-stopped
    volumes:
      - storage-data:/app/.storage
    networks:
      - stargirlnails-network
    healthcheck:
      test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:3000/health"]
      interval: 30s
      timeout: 10s
      retries: 3
      start_period: 40s
    # Keine Abhängigkeit zu nginx, um Dependency-Zyklen zu vermeiden

  # Caddy Reverse Proxy mit automatischem SSL
  caddy:
    image: caddy:2-alpine
    container_name: stargirlnails-caddy
    restart: unless-stopped
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - ./Caddyfile:/etc/caddy/Caddyfile:ro
      - caddy-data:/data
      - caddy-config:/config
    networks:
      - stargirlnails-network
    depends_on:
      - stargirlnails

# Volumes für persistente Daten
volumes:
  storage-data:
    driver: local
  caddy-data:
    driver: local
  caddy-config:
    driver: local

# Netzwerk für interne Kommunikation
networks:
  stargirlnails-network:
    driver: bridge
