| FROM python:3.10 | |
| # 1. Create the specific user required by Hugging Face Spaces | |
| RUN useradd -m -u 1000 user | |
| USER user | |
| ENV PATH="/home/user/.local/bin:$PATH" | |
| # 2. Set the working directory to that user's safe space | |
| WORKDIR /home/user/app | |
| # 3. Copy requirements and install them securely | |
| COPY --chown=user:user requirements.txt . | |
| RUN pip install --user --no-cache-dir -r requirements.txt | |
| # 4. Copy your app.py and images into the safe space | |
| COPY --chown=user:user . . | |
| # 5. Launch using the Python Module bypass (The Fix!) | |
| CMD ["python", "-m", "streamlit", "run", "app.py", "--server.port", "7860", "--server.address", "0.0.0.0"] |