services:
  nginx:
    image: nginx:alpine
    container_name: offerpie-web-nginx
    restart: unless-stopped
    ports:
      - "10302:80"
    healthcheck:
      test: ["CMD", "wget", "--spider", "-q", "http://localhost/health"]
      interval: 30s
      timeout: 10s
      retries: 3
    deploy:
      resources:
        limits:
          memory: 256M
          cpus: '0.5'

  blue:
    image: offerpie-web:test
    container_name: offerpie-web-blue
    restart: unless-stopped
    expose:
      - "80"
    environment:
      - APP_VERSION=blue
      - TZ=Asia/Shanghai
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:80/"]
      interval: 30s
      timeout: 10s
      retries: 3
      start_period: 10s
    deploy:
      resources:
        limits:
          memory: 128M
          cpus: '0.25'

  green:
    image: offerpie-web:test
    container_name: offerpie-web-green
    restart: unless-stopped
    expose:
      - "80"
    environment:
      - APP_VERSION=green
      - TZ=Asia/Shanghai
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:80/"]
      interval: 30s
      timeout: 10s
      retries: 3
      start_period: 10s
    deploy:
      resources:
        limits:
          memory: 128M
          cpus: '0.25'
