Spaces:
Sleeping
Sleeping
| # Use Python 3.11 slim base image | |
| FROM python:3.11-slim | |
| # Create new user with UID 1000, avoid permission issues and improves security | |
| RUN useradd -m -u 1000 user | |
| USER user | |
| # Set working directory inside the container | |
| WORKDIR /app | |
| # Copy requirements.txt into the container and ensures the non-root user (user) owns the file | |
| COPY --chown=user requirements.txt requirements.txt | |
| # Install dependencies from requirements.txt | |
| RUN pip install --no-cache-dir --upgrade -r requirements.txt | |
| # Copy entire project code into container at /app | |
| COPY --chown=user . /app | |
| # Environment Variables | |
| # HEADLESS=true: Run Streamlit in headless mode (no browser popup) | |
| # ENABLECORS=false: Disables CORS checks (important for Spaces) | |
| # PORT=7860: Spaces use this port for the web UI | |
| ENV STREAMLIT_SERVER_HEADLESS=true | |
| ENV STREAMLIT_SERVER_ENABLECORS=false | |
| ENV STREAMLIT_SERVER_PORT=7860 | |
| CMD ["streamlit", "run", "app.py"] |