hackupc2026models / Dockerfile
Dan Vancea
siuuuuuuuuuu
30771f0
Raw
History Blame Contribute Delete
763 Bytes
FROM python:3.10-slim
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
ENV FLASK_APP=call_models.py
# HuggingFace Spaces runs containers as uid=1000
RUN useradd -m -u 1000 user
WORKDIR /app
RUN apt-get update && apt-get install -y --no-install-recommends \
gcc \
python3-dev \
&& rm -rf /var/lib/apt/lists/*
COPY requirements.txt .
# Install CPU-only torch first to avoid pulling the ~2GB CUDA build,
# then install the rest of the requirements.
RUN pip install --no-cache-dir torch --index-url https://download.pytorch.org/whl/cpu && \
pip install --no-cache-dir -r requirements.txt
COPY --chown=user:user . .
USER user
EXPOSE 7860
CMD ["gunicorn", "--bind", "0.0.0.0:7860", "--workers", "2", "--timeout", "120", "call_models:app"]