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" ENV HOME="/home/user" # 2. Set the working directory to that user's safe space WORKDIR $HOME/app # 3. Copy requirements and install them COPY --chown=user:user requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # 4. Copy your app.py and images into the safe space COPY --chown=user:user . . # 5. Launch Streamlit CMD ["streamlit", "run", "app.py", "--server.port", "7860", "--server.address", "0.0.0.0"]