Create Dockerfile
Browse files- Dockerfile +38 -0
Dockerfile
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Use a slim Python base image for efficiency
|
| 2 |
+
FROM python:3.11-slim
|
| 3 |
+
|
| 4 |
+
# Set the working directory
|
| 5 |
+
WORKDIR /app
|
| 6 |
+
|
| 7 |
+
# Install system dependencies required for OpenVINO and image processing
|
| 8 |
+
RUN apt-get update && apt-get install -y \
|
| 9 |
+
libgl1-mesa-glx \
|
| 10 |
+
libglib2.0-0 \
|
| 11 |
+
libgomp1 \
|
| 12 |
+
wget \
|
| 13 |
+
git \
|
| 14 |
+
&& rm -rf /var/lib/apt/lists/*
|
| 15 |
+
|
| 16 |
+
# Copy the requirements file first for better caching
|
| 17 |
+
COPY requirements.txt .
|
| 18 |
+
|
| 19 |
+
# Install Python dependencies
|
| 20 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
| 21 |
+
|
| 22 |
+
# Pre-download the OpenVINO models during the build phase
|
| 23 |
+
RUN mkdir -p /app/models/base /app/models/controlnet /app/models/loras
|
| 24 |
+
|
| 25 |
+
# Download the base LCM model
|
| 26 |
+
RUN wget -q -P /app/models/base https://huggingface.co/rupeshs/LCM-dreamshaper-v7-openvino/resolve/main/dreamshaper-v7-lcm/openvino_model.xml && \
|
| 27 |
+
wget -q -P /app/models/base https://huggingface.co/rupeshs/LCM-dreamshaper-v7-openvino/resolve/main/dreamshaper-v7-lcm/openvino_model.bin
|
| 28 |
+
|
| 29 |
+
# (Optional) You can pre-download the LoRAs here using wget, or let the app download them on-demand.
|
| 30 |
+
|
| 31 |
+
# Copy the application code
|
| 32 |
+
COPY app.py .
|
| 33 |
+
|
| 34 |
+
# Expose the port Hugging Face Spaces uses
|
| 35 |
+
EXPOSE 7860
|
| 36 |
+
|
| 37 |
+
# Command to run the FastAPI application
|
| 38 |
+
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|