Spaces:
Sleeping
Sleeping
| FROM python:3.9.13 | |
| # Install system dependencies (including FFmpeg) | |
| RUN apt-get update && apt-get install -y ffmpeg && \ | |
| rm -rf /var/lib/apt/lists/* # Clean up to reduce image size | |
| # Create a new user with a specific UID and home directory | |
| RUN useradd -m -u 1000 user | |
| # Set the user for subsequent instructions | |
| USER user | |
| # Update the PATH environment variable | |
| ENV PATH="/home/user/.local/bin:${PATH}" | |
| # Set the working directory | |
| WORKDIR /app | |
| # Copy the requirements file into the container | |
| COPY --chown=user ./requirements.txt /app/requirements.txt | |
| # Install Python dependencies | |
| RUN pip install --no-cache-dir --upgrade -r /app/requirements.txt | |
| # Copy the current directory contents into the container at /app | |
| COPY --chown=user . /app | |
| # Streamlit specific environment variables | |
| ENV STREAMLIT_SERVER_HEADLESS=true | |
| ENV STREAMLIT_SERVER_PORT=${PORT} | |
| ENV STREAMLIT_SERVER_ADDRESS=0.0.0.0 | |
| ENV STREAMLIT_SERVER_FILE_WATCHER_TYPE=none | |
| # Expose Streamlit's default port | |
| EXPOSE 7860 | |
| HEALTHCHECK CMD curl --fail http://localhost:7860/_stcore/health | |
| # Command to run the Streamlit app | |
| ENTRYPOINT ["streamlit", "run", "app.py", "--server.port=7860", "--server.address=0.0.0.0"] |