Spaces:
Sleeping
Sleeping
| # Use a Python slim base image with necessary system dependencies | |
| FROM python:3.10-slim | |
| # Install system dependencies for pillow and general compatibility | |
| RUN apt-get update && apt-get install -y \ | |
| libpng-dev \ | |
| libjpeg-dev \ | |
| gcc \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Set working directory | |
| WORKDIR /app | |
| # Copy requirements and install dependencies | |
| COPY requirements.txt . | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Copy the Streamlit app file (in src directory) | |
| COPY src/streamlit_app.py ./src/streamlit_app.py | |
| # Create cache directory with write permissions | |
| RUN mkdir -p /tmp/cache && chmod -R 777 /tmp/cache | |
| # Expose Streamlit's default port | |
| EXPOSE 8501 | |
| # Set environment variable for Hugging Face cache | |
| ENV HUGGINGFACE_HUB_CACHE=/tmp/cache | |
| # Run Streamlit with the correct file path, increased upload size, and disabled XSRF protection | |
| CMD ["streamlit", "run", "src/streamlit_app.py", "--server.maxUploadSize=1000", "--server.port=8501", "--server.enableXsrfProtection=false"] |