Upload Dockerfile with huggingface_hub
Browse files- Dockerfile +37 -0
Dockerfile
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Hugging Face Docker Space - Document Analyzer
|
| 2 |
+
FROM python:3.11-slim
|
| 3 |
+
|
| 4 |
+
# Set working directory
|
| 5 |
+
WORKDIR /app
|
| 6 |
+
|
| 7 |
+
# Install system dependencies required by some Python packages
|
| 8 |
+
RUN apt-get update && apt-get install -y \
|
| 9 |
+
gcc \
|
| 10 |
+
g++ \
|
| 11 |
+
&& rm -rf /var/lib/apt/lists/*
|
| 12 |
+
|
| 13 |
+
# Copy requirements first for Docker layer caching
|
| 14 |
+
COPY requirements.txt .
|
| 15 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
| 16 |
+
|
| 17 |
+
# Copy application code
|
| 18 |
+
COPY app.py .
|
| 19 |
+
COPY static/ ./static/
|
| 20 |
+
|
| 21 |
+
# Create directories and set permissions for HF user (UID 1000)
|
| 22 |
+
RUN mkdir -p /tmp/streamlit && \
|
| 23 |
+
chown -R 1000:1000 /app /tmp/streamlit
|
| 24 |
+
|
| 25 |
+
# Switch to non-root user (required by Hugging Face Spaces)
|
| 26 |
+
USER 1000
|
| 27 |
+
|
| 28 |
+
# Streamlit configuration for headless mode
|
| 29 |
+
ENV STREAMLIT_SERVER_HEADLESS=true
|
| 30 |
+
ENV STREAMLIT_SERVER_ENABLE_CORS=false
|
| 31 |
+
ENV STREAMLIT_SERVER_ADDRESS=0.0.0.0
|
| 32 |
+
|
| 33 |
+
# Hugging Face Spaces expects port 7860
|
| 34 |
+
EXPOSE 7860
|
| 35 |
+
|
| 36 |
+
# Run the Streamlit app on port 7860
|
| 37 |
+
CMD ["streamlit", "run", "app.py", "--server.port", "7860"]
|