Spaces:
Running
Running
# Fill in the base image with the correct Python version (e.g., python:3.11) | |
FROM python:3.11-slim | |
# Fill in the username to be created (e.g., user) | |
RUN useradd -m -u 1000 user | |
# Specify the username for subsequent commands | |
USER user | |
# Fill in the username in the PATH environment variable | |
ENV PATH="/home/user/.local/bin:$PATH" | |
# Set working directory | |
WORKDIR /app | |
# Use the same username for file ownership when copying requirements | |
COPY --chown=user ./requirements.txt requirements.txt | |
RUN pip install --no-cache-dir --upgrade -r requirements.txt | |
# Use the same username for file ownership when copying the app files | |
COPY --chown=user . /app | |
# Start the Streamlit app on port 7860, the default port expected by Spaces | |
CMD ["streamlit", "run", "app.py", "--server.port=7860", "--server.address=0.0.0.0"] | |