FROM python:3.9 | |
# Create a user to avoid running as root | |
RUN useradd -m -u 1000 user | |
USER user | |
# Add Python bin path to environment | |
ENV PATH="/home/user/.local/bin:$PATH" | |
# Set working directory | |
WORKDIR /app | |
# Copy files | |
COPY --chown=user . /app | |
# Install dependencies | |
RUN pip install --no-cache-dir -r requirements.txt | |
# Run Streamlit app on Hugging Face-required port (7860) | |
CMD ["streamlit", "run", "streamlit_app.py", "--server.port=7860", "--server.address=0.0.0.0"] | |