x-defaults: &defaults
  restart: unless-stopped
  logging:
    driver: json-file
    options:
      max-size: 100m
      max-file: '3'

services:
  playwright:
    <<: *defaults
    image: ${GLOBAL_REGISTRY:-}mcp/playwright:${PLAYWRIGHT_VERSION:-latest}
    environment:
      - MCP_HOST=0.0.0.0
      - TZ=${TZ:-UTC}
    ports:
      - '${PLAYWRIGHT_PORT_OVERRIDE:-8000}:8000'
    volumes:
      - playwright_data:/app/data
    healthcheck:
      test: [CMD, wget, --spider, -q, 'http://localhost:8000/health']
      interval: 30s
      timeout: 10s
      retries: 3
      start_period: 20s
    deploy:
      resources:
        limits:
          cpus: '2.00'
          memory: 2G
        reservations:
          cpus: '0.5'
          memory: 512M
    security_opt:
      - seccomp:unconfined
    shm_size: 2gb

volumes:
  playwright_data:
