sniki28's picture
Upload Dockerfile with huggingface_hub
9b50fed verified
raw
history blame contribute delete
835 Bytes
# Content Moderation Queue — OpenEnv
# Compatible with Hugging Face Spaces (CPU, 2 vCPU, 8 GB RAM)
FROM python:3.10-slim
# HF Spaces expects the app to run as a non-root user
RUN useradd -m -u 1000 user
USER user
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH
WORKDIR /home/user/app
# Install dependencies
COPY --chown=user requirements.txt .
RUN pip install --no-cache-dir --upgrade pip \
&& pip install --no-cache-dir -r requirements.txt
# Copy application
COPY --chown=user . .
# Expose port (HF Spaces uses 7860)
EXPOSE 7860
# Health check
HEALTHCHECK --interval=15s --timeout=5s --start-period=10s --retries=3 \
CMD python -c "import urllib.request; urllib.request.urlopen('http://localhost:7860/health')"
# Start server
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "1"]