Spaces:
No application file
No application file
| FROM python:3.9-slim | |
| # Install required packages and git clone as root | |
| RUN apt-get update && apt-get install -y \ | |
| build-essential \ | |
| curl \ | |
| software-properties-common \ | |
| git \ | |
| && rm -rf /var/lib/apt/lists/* \ | |
| && git clone https://github.com/streamlit/streamlit-example.git /app | |
| # Add user and set environment variables | |
| RUN useradd -m -u 1000 user | |
| USER user | |
| ENV PATH="/home/user/.local/bin:$PATH" | |
| # Set the working directory | |
| WORKDIR /app | |
| # Copy requirements.txt and install Python packages | |
| COPY --chown=user ./requirements.txt requirements.txt | |
| RUN pip install --no-cache-dir --upgrade -r requirements.txt | |
| # Copy the rest of the application code | |
| COPY --chown=user . /app | |
| # Expose the port that Streamlit will run on | |
| EXPOSE 8501 | |
| # Define a health check | |
| HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health || exit 1 | |
| # Define the entrypoint command to run the Streamlit app | |
| ENTRYPOINT ["streamlit", "run", "app.py", "--server.port=8501", "--server.address=0.0.0.0"] | |