services:
  epicrisis:
    build:
      context: .
    image: epicrisisia-all-in-one:latest
    container_name: epicrisisia
    ports:
      - "7000:7000"
    environment:
      SECRET_KEY: ${SECRET_KEY:?define SECRET_KEY}
      ADMIN_USERNAME: ${ADMIN_USERNAME:-admin}
      ADMIN_PASSWORD: ${ADMIN_PASSWORD:?define ADMIN_PASSWORD}
      ADMIN_FORCE_RESET: ${ADMIN_FORCE_RESET:-0}
      MONGO_APP_DATABASE: ${MONGO_APP_DATABASE:-Epicrisis}
      MONGO_APP_USERNAME: ${MONGO_APP_USERNAME:-epicrisis_app}
      MONGO_APP_PASSWORD: ${MONGO_APP_PASSWORD:?define MONGO_APP_PASSWORD}
      MONGO_APP_FORCE_RESET: ${MONGO_APP_FORCE_RESET:-0}
      MONGO_URI: mongodb://${MONGO_APP_USERNAME:-epicrisis_app}:${MONGO_APP_PASSWORD}@127.0.0.1:27017/${DB_NAME:-Epicrisis}?authSource=${MONGO_APP_DATABASE:-Epicrisis}
      DB_NAME: ${DB_NAME:-Epicrisis}
      COLLECTION_NAME: ${COLLECTION_NAME:-HistoriaClinica}
      REDIS_URL: redis://127.0.0.1:6379/0
      BATCH_DISPATCHER: ${BATCH_DISPATCHER:-celery}
      LLM_PROVIDER: ${LLM_PROVIDER:-gemini}
      GROQ_API_KEY: ${GROQ_API_KEY:-}
      GEMINI_API_KEY: ${GEMINI_API_KEY:-}
      GOOGLE_API_KEY: ${GOOGLE_API_KEY:-}
      APP_HOST: ${APP_HOST:-0.0.0.0}
      APP_PORT: ${APP_PORT:-7000}
      CELERY_CONCURRENCY: ${CELERY_CONCURRENCY:-2}
      AUDIT_LOG_ENABLED: ${AUDIT_LOG_ENABLED:-true}
      AUDIT_LOG_FILE: ${AUDIT_LOG_FILE:-logs/audit.jsonl}
      AUDIT_LOG_LEVEL: ${AUDIT_LOG_LEVEL:-INFO}
      AUDIT_MONGO_ENABLED: ${AUDIT_MONGO_ENABLED:-true}
      AUDIT_RETENTION_DAYS: ${AUDIT_RETENTION_DAYS:-180}
      EPICRISIS_AUTO_MIGRATE: ${EPICRISIS_AUTO_MIGRATE:-1}
      EPICRISIS_AUTO_BOOTSTRAP_ADMIN: ${EPICRISIS_AUTO_BOOTSTRAP_ADMIN:-1}
      EPICRISIS_AUTO_WARMUP: ${EPICRISIS_AUTO_WARMUP:-0}
      EPICRISIS_WARMUP_RESOURCES: ${EPICRISIS_WARMUP_RESOURCES:-cie10,cups}
    volumes:
      - epicrisis-data:/data
    restart: unless-stopped

volumes:
  epicrisis-data:
