Spaces:
Sleeping
Sleeping
| # Use Python 3.11 to fix Google API warnings | |
| FROM python:3.11 | |
| # Create a user to run the app (security best practice for Spaces) | |
| RUN useradd -m -u 1000 user | |
| USER user | |
| ENV HOME=/home/user \ | |
| PATH=/home/user/.local/bin:$PATH | |
| WORKDIR $HOME/app | |
| # Switch to root to install system dependencies for images | |
| USER root | |
| RUN apt-get update && apt-get install -y \ | |
| libgl1 \ | |
| libglib2.0-0 \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Switch back to user | |
| USER user | |
| # Copy files and install Python dependencies | |
| COPY --chown=user . $HOME/app | |
| RUN pip install --no-cache-dir --upgrade pip | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Run the app | |
| EXPOSE 7860 | |
| CMD ["streamlit", "run", "app.py", "--server.port=7860", "--server.address=0.0.0.0"] |