Spaces:
Sleeping
Sleeping
| FROM python:3.10-slim | |
| # 1. System dependencies (Rarely change - cached first) | |
| RUN apt-get update && apt-get install -y \ | |
| build-essential \ | |
| libgl1 \ | |
| libglu1-mesa \ | |
| git \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # 2. Setup user | |
| RUN useradd -m -u 1000 user | |
| USER user | |
| ENV HOME=/home/user \ | |
| PATH=/home/user/.local/bin:$PATH | |
| WORKDIR $HOME/app | |
| # 3. Python Requirements (Only re-installs if requirements.txt changes) | |
| COPY --chown=user requirements.txt $HOME/app/requirements.txt | |
| RUN pip install --no-cache-dir --upgrade -r requirements.txt | |
| # 4. App Code (Changes constantly - cached last) | |
| # This ensures a 1-line change in app.py doesn't re-trigger pip install! | |
| COPY --chown=user . $HOME/app | |
| # 5. Launch | |
| # GRADIO_SERVER_NAME ensures it binds to the HF internal network | |
| ENV GRADIO_SERVER_NAME="0.0.0.0" | |
| EXPOSE 7860 | |
| CMD ["python", "app.py"] |