FROM python:3.11-slim # Install all dependencies (build + runtime) RUN apt-get update && apt-get install -y \ git cmake clang build-essential curl libgomp1 \ && rm -rf /var/lib/apt/lists/* # Create non-root user RUN useradd -ms /bin/bash user WORKDIR /home/user/app # Install Python deps first (cached layer) COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # Copy app files COPY app.py start.sh ./ RUN chmod +x start.sh RUN chown -R user:user /home/user/app USER user EXPOSE 7860 ENV GRADIO_SERVER_NAME="0.0.0.0" ENV GRADIO_SERVER_PORT="7860" CMD ["./start.sh"]