version: '3.8'

services:
  web:
    build:
      context: .
      dockerfile: docker/Dockerfile
      platforms:
        - "linux/amd64"
        - "linux/arm64"
    platform: linux/amd64
    image: nice-app-web:latest
    container_name: nice-app-web
    ports:
      - "3000:80"
    environment:
      - NODE_ENV=production
    restart: unless-stopped
    healthcheck:
      test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost/health"]
      interval: 30s
      timeout: 10s
      retries: 3
      start_period: 40s
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.web.rule=Host(`localhost`)"
      - "traefik.http.services.web.loadbalancer.server.port=80"

  # Development service (optional)
  web-dev:
    build:
      context: .
      dockerfile: docker/Dockerfile.dev
      platforms:
        - "linux/amd64"
        - "linux/arm64"
    platform: linux/amd64
    container_name: nice-app-web-dev
    ports:
      - "5173:5173"
    volumes:
      - .:/app
      - /app/node_modules
    environment:
      - NODE_ENV=development
    command: npm run dev
    profiles:
      - dev

networks:
  default:
    driver: bridge

volumes:
  node_modules: