services:
  mobilemodels:
    build:
      context: .
      dockerfile: Dockerfile
    container_name: mobilemodels-web
    working_dir: /app
    environment:
      MOBILEMODELS_DATA_ROOT: /data
      TZ: ${TZ:-Asia/Shanghai}
      MYSQL_HOST: ${MYSQL_HOST:-host.docker.internal}
      MYSQL_PORT: ${MYSQL_PORT:-3306}
      MYSQL_DATABASE: ${MYSQL_DATABASE:-mobilemodels}
      MYSQL_ROOT_USER: ${MYSQL_ROOT_USER:-root}
      MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD:-mobilemodels_root}
      MYSQL_READER_USER: ${MYSQL_READER_USER:-mobilemodels_reader}
      MYSQL_READER_PASSWORD: ${MYSQL_READER_PASSWORD:-mobilemodels_reader_change_me}
      MYSQL_AUTO_LOAD: ${MYSQL_AUTO_LOAD:-0}
      SYNC_SCHEDULE_ENABLED: ${SYNC_SCHEDULE_ENABLED:-0}
      SYNC_SCHEDULE_TIME: ${SYNC_SCHEDULE_TIME:-03:00}
      GITHUB_PROXY_PREFIX: ${GITHUB_PROXY_PREFIX:-}
    command: ["sh", "tools/container_start.sh"]
    ports:
      - "8123:8123"
    volumes:
      - ./dist:/app/dist
      - mobilemodels_app_data:/data
    extra_hosts:
      - "host.docker.internal:host-gateway"
    restart: unless-stopped
    init: true

volumes:
  mobilemodels_app_data:
