services:
  new-api:
    build:
      context: .
      dockerfile: Dockerfile
    image: new-api-local:test
    container_name: new-api
    restart: always
    command: --log-dir /app/logs
    env_file:
      - .env
    ports:
      - "${NEWAPI_PORT}:3000"
    volumes:
      - /root/docker/newapi/data:/data
      - /root/docker/newapi/logs:/app/logs
    environment:
      - SQL_DSN=postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:${POSTGRES_PORT}/${POSTGRES_DB}
      - REDIS_CONN_STRING=${REDIS_CONN_STRING}
      - TZ=${TZ}
      - ERROR_LOG_ENABLED=${ERROR_LOG_ENABLED}
      - BATCH_UPDATE_ENABLED=${BATCH_UPDATE_ENABLED}
    depends_on:
      - redis
    healthcheck:
      test: ["CMD-SHELL", "wget -q -O - http://localhost:3000/api/status | grep -o '\"success\":\\s*true' || exit 1"]
      interval: 30s
      timeout: 10s
      retries: 3

  redis:
    image: redis:latest
    container_name: redis
    restart: always
