services:
  web:
    pull_policy: build
    build:
      context: ../..
      dockerfile: containers/web/python/Containerfile
      target: ${TARGET:-production}
      args:
        UV_NO_DEV: 0
    env_file:
      - ../../.env
    restart: unless-stopped
    command: ["-m", "http.server"] # Run Python's built-in HTTP server module
    networks:
      - app
      - wan
    healthcheck:
      test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://web:8000/')"]
      interval: 10s
      retries: 5
      start_period: 30s
      timeout: 10s
    deploy:
      mode: replicated
      replicas: 2
    stop_grace_period: 1m
