File size: 977 Bytes
37fed47 | 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 28 29 30 31 32 33 34 35 36 37 | # Hugging Face Docker Space - Document Analyzer
FROM python:3.11-slim
# Set working directory
WORKDIR /app
# Install system dependencies required by some Python packages
RUN apt-get update && apt-get install -y \
gcc \
g++ \
&& rm -rf /var/lib/apt/lists/*
# Copy requirements first for Docker layer caching
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Copy application code
COPY app.py .
COPY static/ ./static/
# Create directories and set permissions for HF user (UID 1000)
RUN mkdir -p /tmp/streamlit && \
chown -R 1000:1000 /app /tmp/streamlit
# Switch to non-root user (required by Hugging Face Spaces)
USER 1000
# Streamlit configuration for headless mode
ENV STREAMLIT_SERVER_HEADLESS=true
ENV STREAMLIT_SERVER_ENABLE_CORS=false
ENV STREAMLIT_SERVER_ADDRESS=0.0.0.0
# Hugging Face Spaces expects port 7860
EXPOSE 7860
# Run the Streamlit app on port 7860
CMD ["streamlit", "run", "app.py", "--server.port", "7860"] |