Spaces:
Runtime error
Runtime error
File size: 884 Bytes
0ddcb86 | 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 | FROM python:3.11-slim
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
PIP_NO_CACHE_DIR=1
WORKDIR /app
# System deps for lightgbm / xgboost wheels
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
libgomp1 \
curl \
&& rm -rf /var/lib/apt/lists/*
COPY requirements.txt .
RUN pip install --upgrade pip && pip install -r requirements.txt
COPY . .
# Pre-train a baseline model so the first request works even without a manual /train-model call.
# Comment out if you want a cold start.
RUN python -m app.training.train || echo "Initial training failed; will fall back to physics."
EXPOSE 8000
HEALTHCHECK --interval=30s --timeout=5s --start-period=15s --retries=3 \
CMD curl -fsS http://localhost:8000/api/v1/health || exit 1
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000", "--workers", "2"]
|