File size: 1,880 Bytes
1a3db60 ffe2ac5 1a3db60 ffe2ac5 1a3db60 ffe2ac5 1a3db60 a13ee72 1a3db60 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 | # ============================================================================
# KRONECTOR — Hugging Face Spaces Dockerfile
# ============================================================================
# HF Spaces runs a single container, so we combine FastAPI + Streamlit
# behind a simple process manager. HF exposes port 7860 by default.
#
# Deploy:
# 1. Create a Space on huggingface.co (SDK: Docker)
# 2. Push this repo to the Space
# 3. Set GROQ_API_KEY as a Space Secret
# ============================================================================
FROM python:3.11-slim
WORKDIR /app
# LightGBM requires libgomp (OpenMP runtime)
RUN apt-get update && apt-get install -y --no-install-recommends \
libgomp1 \
curl \
supervisor \
&& rm -rf /var/lib/apt/lists/*
COPY --chown=1000:1000 requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Copy application code
COPY --chown=1000:1000 agents/ ./agents/
COPY --chown=1000:1000 api/ ./api/
COPY --chown=1000:1000 ml/ ./ml/
COPY --chown=1000:1000 data/ ./data/
COPY --chown=1000:1000 scripts/ ./scripts/
COPY --chown=1000:1000 run_api.py run_all.py ./
# Copy pre-trained model artifacts and data
COPY --chown=1000:1000 data_output/ ./data_output/
COPY --chown=1000:1000 mlruns/ ./mlruns/
COPY --chown=1000:1000 mlflow.db ./mlflow.db
# Supervisor config — runs FastAPI on 7860 (HF's expected port)
RUN cat > /etc/supervisor/conf.d/kronector.conf << 'EOF'
[supervisord]
nodaemon=true
logfile=/dev/stdout
logfile_maxbytes=0
[program:fastapi]
command=uvicorn api.main:app --host 0.0.0.0 --port 7860
autostart=true
autorestart=true
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
EOF
# HF Spaces expects port 7860
EXPOSE 7860
ENV MLFLOW_ALLOW_FILE_STORE=true
CMD ["supervisord", "-c", "/etc/supervisor/supervisord.conf"]
|