smilystudyworker / Dockerfile
Bc-AI's picture
Create Dockerfile
4be4d90 verified
Raw History Blame Contribute Delete
604 Bytes
# Dockerfile for HuggingFace Docker Space
# Runtime: CPU-only free tier — no GPU needed, we just proxy OpenRouter
FROM python:3.11-slim
# HF Spaces runs as non-root user 1000
RUN useradd -m -u 1000 worker
WORKDIR /app
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
COPY worker.py .
# HF Spaces expects the app on port 7860
ENV PORT=7860
EXPOSE 7860
# Switch to non-root
USER 1000
# uvicorn with 1 worker — HF free tier is single-core anyway
CMD ["uvicorn", "worker:app", "--host", "0.0.0.0", "--port", "7860", \
"--workers", "1", "--timeout-keep-alive", "120"]