Sluethink / Dockerfile
topGdev's picture
Add Dockerfile for HF Spaces deployment
8b959f3
raw
history blame
869 Bytes
# Read the doc: https://huggingface.co/docs/hub/spaces-sdks-docker
# Based on HF Spaces best practices
FROM python:3.12-slim-bullseye
# Update system packages to patch vulnerabilities
RUN apt-get update && apt-get upgrade -y && rm -rf /var/lib/apt/lists/*
# Create non-root user for security
RUN useradd -m -u 1000 user
USER user
ENV PATH="/home/user/.local/bin:$PATH"
WORKDIR /app
# Copy and install requirements
COPY --chown=user ./requirements.txt requirements.txt
RUN pip install --no-cache-dir --upgrade -r requirements.txt
# Download NLTK data
RUN python -m nltk.downloader stopwords wordnet punkt_tab
# Install Playwright browsers
RUN playwright install chromium
# Copy application code
COPY --chown=user . /app
# Expose port (HF Spaces uses 7860)
EXPOSE 7860
# Run the application
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"]