| FROM python:3.10-slim | |
| # Set working directory | |
| WORKDIR /app | |
| # Install system dependencies, including libgl1 for OpenCV | |
| RUN apt-get update && apt-get install -y \ | |
| git \ | |
| git-lfs \ | |
| gcc \ | |
| python3-dev \ | |
| libgl1 \ | |
| libglib2.0-0 \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Clone the FastSD CPU repository | |
| RUN git clone https://github.com/rupeshs/fastsdcpu.git . | |
| # Create and set permissions for writable directories | |
| RUN mkdir -p /.cache/huggingface /app/configs /app/results /app/.openvino_telemetry \ | |
| && chmod -R 777 /.cache /app | |
| # Set HF_HOME for Hugging Face cache (replacing TRANSFORMERS_CACHE) | |
| ENV HF_HOME=/app/.cache/huggingface | |
| # Upgrade pip and install dependencies | |
| RUN pip install --upgrade pip | |
| RUN pip install -r requirements.txt | |
| # Expose port for FastAPI server | |
| EXPOSE 8000 | |
| # Command to run the FastAPI server | |
| CMD ["python", "src/app.py", "--api"] |