Spaces:
Sleeping
Sleeping
File size: 761 Bytes
e5d4b6d | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | 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"]
|