services:
  hoerdle:
    container_name: hoerdle
    build:
      context: .
      dockerfile: Dockerfile
      args:
        NEXT_PUBLIC_APP_NAME: ${NEXT_PUBLIC_APP_NAME}
        NEXT_PUBLIC_APP_DESCRIPTION: ${NEXT_PUBLIC_APP_DESCRIPTION}
        NEXT_PUBLIC_DOMAIN: ${NEXT_PUBLIC_DOMAIN}
        NEXT_PUBLIC_PLAUSIBLE_SCRIPT_SRC: ${NEXT_PUBLIC_PLAUSIBLE_SCRIPT_SRC}
        NEXT_PUBLIC_THEME_COLOR: ${NEXT_PUBLIC_THEME_COLOR}
        NEXT_PUBLIC_BACKGROUND_COLOR: ${NEXT_PUBLIC_BACKGROUND_COLOR}
        NEXT_PUBLIC_CREDITS_ENABLED: ${NEXT_PUBLIC_CREDITS_ENABLED}
        NEXT_PUBLIC_CREDITS_TEXT: ${NEXT_PUBLIC_CREDITS_TEXT}
        NEXT_PUBLIC_CREDITS_LINK_TEXT: ${NEXT_PUBLIC_CREDITS_LINK_TEXT}
        NEXT_PUBLIC_CREDITS_LINK_URL: ${NEXT_PUBLIC_CREDITS_LINK_URL}
    user: root
    restart: always
    ports:
      - "3010:3000"
    environment:
      - DATABASE_URL=file:/app/data/prod.db
      - ADMIN_PASSWORD=$$2b$$10$$SHOt9G1qUNIvHoWre7499.eEtp5PtOII0daOQGNV.dhDEuPmOUdsq # Change this! Must be a bcrypt hash. Escape $ as $$ in docker-compose!
      - TZ=Europe/Berlin # Timezone for daily puzzle rotation
      - GOTIFY_URL=https://gotify.example.com
      - GOTIFY_APP_TOKEN=your_gotify_token
      - OPENROUTER_API_KEY=your_openrouter_api_key
    volumes:
      - ./data:/app/data
      - ./public/uploads:/app/public/uploads
    healthcheck:
      test: [ "CMD", "curl", "-f", "http://localhost:3000/api/daily" ]
      interval: 30s
      timeout: 10s
      retries: 3
      start_period: 40s
    networks:
      - default
    # docker-entrypoint.sh handles migrations and server startup (with baseline fallback)

networks:
  default:
    name: hoerdle_default
    external: true
