Spaces:
Running
Running
File size: 736 Bytes
d4c51f2 | 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 | # Hugging Face Spaces runs this as the container entrypoint (sdk: docker).
# HF exposes port 7860 and runs the container as a non-root user (uid 1000),
# so we install deps as root, then chown the app so runtime writes (e.g. the
# subscribers CSV) don't hit a permission error.
FROM python:3.11-slim
ENV PYTHONUNBUFFERED=1 \
PIP_NO_CACHE_DIR=1 \
MPLCONFIGDIR=/tmp/mpl \
PORT=7860
WORKDIR /app
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
COPY . .
RUN useradd -m -u 1000 appuser \
&& mkdir -p /app/data \
&& chown -R appuser:appuser /app
USER appuser
EXPOSE 7860
CMD ["gunicorn", "webapp.app:app", "--bind", "0.0.0.0:7860", "--workers", "1", "--threads", "4", "--timeout", "120"]
|