Spaces:
Sleeping
Sleeping
File size: 807 Bytes
f3523ce 6b0cf06 | 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 | FROM python:3.11-slim
WORKDIR /app
COPY requirements.txt .
# 🟢 Add this block BEFORE pip install:
RUN apt-get update && apt-get install -y libgomp1
RUN pip install --no-cache-dir -r requirements.txt
COPY main.py .
COPY hidden_logic/ ./hidden_logic/
# Create shutdown script
RUN echo '#!/bin/bash\nsleep 300\nkill -15 1' > /app/shutdown.sh && chmod +x /app/shutdown.sh
EXPOSE 7860
# Use 8 cores for numpy/scipy/pandas (OpenMP, MKL, OpenBLAS, NumExpr)
ENV OMP_NUM_THREADS=4
ENV MKL_NUM_THREADS=4
ENV OPENBLAS_NUM_THREADS=4
ENV NUMEXPR_NUM_THREADS=4
# Start both the API and shutdown script.
# Keep a single worker because fit/forecast state is in-memory per process.
CMD ["/bin/bash", "-c", "/app/shutdown.sh & uvicorn main:app --host 0.0.0.0 --port 7860 --workers 1"] |