doc-analyzer / Dockerfile
Leearg's picture
Upload Dockerfile with huggingface_hub
37fed47 verified
Raw
History Blame Contribute Delete
977 Bytes
# 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"]