services:
  ccg-staging:
    build: .
    container_name: ccg-staging
    restart: unless-stopped
    environment:
      - NODE_ENV=production
      - MOLLIE_API_KEY=${MOLLIE_API_KEY}
      - NEXT_PUBLIC_BASE_URL=https://staging-ccg.jeffemmett.com
      - GOOGLE_SERVICE_ACCOUNT_KEY=${GOOGLE_SERVICE_ACCOUNT_KEY}
      - GOOGLE_SHEET_ID=${GOOGLE_SHEET_ID}
      - GOOGLE_SHEET_NAME=${GOOGLE_SHEET_NAME:-Registrations}
      - SMTP_HOST=${SMTP_HOST:-mail.rmail.online}
      - SMTP_PORT=${SMTP_PORT:-587}
      - SMTP_USER=${SMTP_USER:-newsletter@cryptocommonsgather.ing}
      - SMTP_PASS=${SMTP_PASS}
      - EMAIL_FROM=${EMAIL_FROM:-Crypto Commons Gathering <newsletter@cryptocommonsgather.ing>}
      - LISTMONK_DB_HOST=${LISTMONK_DB_HOST:-listmonk-db}
      - LISTMONK_DB_PORT=${LISTMONK_DB_PORT:-5432}
      - LISTMONK_DB_NAME=${LISTMONK_DB_NAME:-listmonk}
      - LISTMONK_DB_USER=${LISTMONK_DB_USER:-listmonk}
      - LISTMONK_DB_PASS=${LISTMONK_DB_PASS}
      - LISTMONK_LIST_ID=${LISTMONK_LIST_ID:-22}
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.ccg-staging.rule=Host(`staging-ccg.jeffemmett.com`)"
      - "traefik.http.routers.ccg-staging.entrypoints=web,websecure"
      - "traefik.http.services.ccg-staging.loadbalancer.server.port=3000"
    healthcheck:
      test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://127.0.0.1:3000/"]
      interval: 30s
      timeout: 10s
      retries: 3
      start_period: 15s
    networks:
      - traefik-public
      - listmonk-internal

networks:
  traefik-public:
    external: true
  listmonk-internal:
    external:
      name: listmonk_listmonk-internal
