| FROM python:3.9 | |
| # Create non-root user | |
| RUN useradd -m -u 1000 user | |
| USER user | |
| ENV PATH="/home/user/.local/bin:$PATH" | |
| # Set working directory | |
| WORKDIR /app | |
| # Clone the FastSD CPU repository | |
| RUN git clone https://github.com/rupeshs/fastsdcpu.git . | |
| # Install Python dependencies | |
| RUN python -m venv env && \ | |
| . env/bin/activate && \ | |
| pip install --upgrade pip && \ | |
| pip install torch==2.2.2 --index-url https://download.pytorch.org/whl/cpu && \ | |
| pip install -r requirements.txt | |
| # Expose port for FastAPI server | |
| EXPOSE 8000 | |
| # Command to run the FastAPI server | |
| CMD ["python", "src/app.py", "--api"] |