services:
  # ---- Development ----
  app-dev:
    build:
      context: .
      dockerfile: Dockerfile
      target: dev
    ports:
      - "3000:3000"
    environment:
      - NODE_ENV=development
      - HOSTNAME=0.0.0.0
    # Hot-Reload & persistente Caches
    volumes:
      - .:/app
      - node_modules:/app/node_modules
      - next:/app/.next
    # CMD kommt aus Dockerfile (npm run dev)
    profiles: [dev]

  # ---- Production ----
  app-prod:
    build:
      context: .
      dockerfile: Dockerfile
      # target: runner  # (optional; letzter Stage ist ohnehin runner)
    ports:
      - "3010:3000"
    environment:
      - NODE_ENV=production
      - SITE_URL=${SITE_URL:-https://hamtonbrown.com}
      - CONTACT_TO_EMAIL=${CONTACT_TO_EMAIL:-contact@hamtonbrown.com}
      - RESEND_API_KEY=${RESEND_API_KEY}
    restart: unless-stopped
    profiles: [prod]

volumes:
  node_modules:
  next:

networks:
  default:
    name: hamtonbrown-network
