Spaces:
Build error
Build error
| # Use an official PyTorch image with CUDA support | |
| FROM pytorch/pytorch:2.1.0-cuda12.1-cudnn8-runtime | |
| # Set environment variables | |
| ENV PYTHONUNBUFFERED=1 \ | |
| GRADIO_ALLOW_FLAGGING=never \ | |
| GRADIO_NUM_PORTS=1 \ | |
| GRADIO_SERVER_NAME="0.0.0.0" \ | |
| GRADIO_THEME=huggingface \ | |
| HOME=/home/user | |
| # Install system dependencies | |
| RUN apt-get update && apt-get install -y \ | |
| git \ | |
| libgl1-mesa-glx \ | |
| libglib2.0-0 \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Create a non-root user | |
| RUN useradd -m -u 1000 user | |
| USER user | |
| WORKDIR $HOME/app | |
| # Copy requirements and install | |
| # (Assuming you have a requirements.txt with diffusers, transformers, accelerate, gradio) | |
| COPY --chown=user requirements.txt . | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Copy the rest of the application | |
| COPY --chown=user . . | |
| # Make the startup script executable | |
| RUN chmod +x start.sh | |
| # Expose the port Gradio runs on | |
| EXPOSE 7860 | |
| # Run the startup script | |
| CMD ["./start.sh"] |