FROM python:3.10-slim RUN useradd -m -u 1000 user USER user ENV HOME=/home/user PATH=/home/user/.local/bin:$PATH WORKDIR $HOME/app # Copy requirements and install dependencies COPY --chown=user requirements.txt . # Install torch CPU first, then other requirements RUN pip install --no-cache-dir --upgrade pip && \ pip install --no-cache-dir torch --index-url https://download.pytorch.org/whl/cpu && \ pip install --no-cache-dir -r requirements.txt # Copy all application files COPY --chown=user . . ENV PYTHONUNBUFFERED=1 ENV SPACE_ID=1 EXPOSE 7860 CMD ["streamlit", "run", "streamlit_app.py", "--server.port=7860", "--server.address=0.0.0.0"]