Spaces:
Sleeping
Sleeping
| FROM python:3.11-slim | |
| # Create a non-root user and set up home | |
| RUN useradd -m appuser | |
| USER appuser | |
| ENV HOME=/home/appuser | |
| WORKDIR $HOME | |
| # Copy code and requirements | |
| COPY requirements.txt ./ | |
| COPY src/ ./src/ | |
| COPY data/ ./data/ | |
| # Install Python dependencies for the user | |
| RUN pip3 install --user -r requirements.txt | |
| # Make sure user-level bin is in PATH | |
| ENV PATH=$HOME/.local/bin:$PATH | |
| # (Optional) Set up cache for torch if needed | |
| RUN mkdir -p $HOME/.cache/torch | |
| # Expose Streamlit's default port | |
| EXPOSE 8501 | |
| # Disable XSRF protection for compatibility (optional, but safe for student demos) | |
| ENV ENABLE_XSRF_PROTECTION=false | |
| # Run the Streamlit app | |
| ENTRYPOINT ["streamlit", "run", "src/streamlit_app.py", "--server.port=8501", "--server.address=0.0.0.0"] | |