FROM pytorch/pytorch:1.12.1-cuda11.3-cudnn8-runtime # Set working directory WORKDIR /code # Install system dependencies RUN apt-get update && apt-get install -y \ build-essential \ python3-dev \ git \ cmake \ libcairo2-dev \ pkg-config \ && rm -rf /var/lib/apt/lists/* # Install Python dependencies RUN pip install --no-cache-dir \ fastapi==0.95.2 \ uvicorn==0.22.0 \ Pillow==9.5.0 \ cairosvg==2.7.0 \ numpy==1.24.3 \ requests==2.31.0 \ git+https://github.com/openai/CLIP.git # Install diffvg RUN git clone https://github.com/BachiLi/diffvg.git && \ cd diffvg && \ git submodule update --init --recursive && \ python setup.py install # Copy the model files COPY . /code/ # Create a directory for model weights RUN mkdir -p /code/model_weights # Set environment variables ENV MODEL_DIR=/code/model_weights ENV PYTHONPATH=/code # Expose the port EXPOSE 8000 # Start the API server CMD ["python", "api.py"]