Create Dockerfile
Browse files- Dockerfile +40 -0
Dockerfile
ADDED
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
FROM python:3.10
|
2 |
+
|
3 |
+
# Install system dependencies
|
4 |
+
RUN apt-get update && apt-get install -y \
|
5 |
+
git \
|
6 |
+
git-lfs \
|
7 |
+
ffmpeg \
|
8 |
+
libsm6 \
|
9 |
+
libxext6 \
|
10 |
+
cmake \
|
11 |
+
rsync \
|
12 |
+
libgl1-mesa-glx \
|
13 |
+
wget \
|
14 |
+
&& rm -rf /var/lib/apt/lists/* \
|
15 |
+
&& git lfs install
|
16 |
+
|
17 |
+
# Set working directory
|
18 |
+
WORKDIR /app
|
19 |
+
|
20 |
+
# Copy requirements and install
|
21 |
+
COPY requirements.txt .
|
22 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
23 |
+
|
24 |
+
# Clone and setup ComfyUI
|
25 |
+
RUN git clone https://github.com/comfyanonymous/ComfyUI.git /app/ComfyUI && \
|
26 |
+
cd /app/ComfyUI && \
|
27 |
+
pip install -r requirements.txt
|
28 |
+
|
29 |
+
# Download Stable Diffusion checkpoint directly (use fp16 for CPU efficiency)
|
30 |
+
RUN mkdir -p ComfyUI/models/checkpoints && \
|
31 |
+
wget -O ComfyUI/models/checkpoints/v1-5-pruned-emaonly-fp16.safetensors https://huggingface.co/runwayml/stable-diffusion-v1-5/resolve/main/v1-5-pruned-emaonly-fp16.safetensors
|
32 |
+
|
33 |
+
# Copy app files
|
34 |
+
COPY . .
|
35 |
+
|
36 |
+
# Run as non-root user
|
37 |
+
RUN useradd -m -u 1000 user && chown -R user:user /app
|
38 |
+
USER user
|
39 |
+
|
40 |
+
CMD ["python", "app.py"]
|