Spaces:
Sleeping
Sleeping
| # Use the official Python image from Docker Hub | |
| FROM python:3.11-slim | |
| # Set the working directory | |
| WORKDIR /app | |
| # Copy the application files | |
| COPY app.py /app/ | |
| COPY requirements.txt /app/ | |
| # Create a writable cache directory for Hugging Face | |
| ENV HF_HOME=/app/hf_cache | |
| RUN mkdir -p /app/hf_cache | |
| # Set permissions for the cache directory | |
| RUN chmod -R 777 /app/hf_cache | |
| # Install dependencies | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Create a non-root user and switch to it | |
| RUN useradd -m appuser | |
| USER appuser | |
| # Expose the Streamlit port | |
| EXPOSE 7860 | |
| # Run the Streamlit app | |
| CMD ["streamlit", "run", "app.py", "--server.port=7860", "--server.address=0.0.0.0"] | |