version: '3.4'

services:
  new-api-custom:
    build:
      context: .
      dockerfile: Dockerfile
    image: new-api-custom:latest
    container_name: new-api-custom
    restart: always
    command: --log-dir /app/logs
    ports:
      - "3099:3000"
    volumes:
      - ./data:/data
      - ./logs-custom:/app/logs
    environment:
      - SQL_DSN=root:123456@tcp(mysql:3306)/new-api
      - REDIS_CONN_STRING=redis://redis
      - TZ=Asia/Shanghai
      - ERROR_LOG_ENABLED=true
    healthcheck:
      test: ["CMD-SHELL", "wget -q -O - http://localhost:3000/api/status | grep -o '\"success\":\\s*true' | awk -F: '{print $$2}'"]
      interval: 30s
      timeout: 10s
      retries: 3
    networks:
      - new-api_default

networks:
  new-api_default:
    external: true