-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathDockerfile
More file actions
58 lines (46 loc) · 2.24 KB
/
Copy pathDockerfile
File metadata and controls
58 lines (46 loc) · 2.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# Stage 1: Build Python dependencies with uv (Python 3.12 pinned)
FROM ghcr.io/astral-sh/uv:python3.12-bookworm-slim AS builder
ENV UV_COMPILE_BYTECODE=1 UV_LINK_MODE=copy UV_PYTHON_DOWNLOADS=0
ARG COMFYUI_VERSION=v0.30.0
# Clone ComfyUI
RUN apt-get update && apt-get install -y git && \
git clone --depth 1 --branch ${COMFYUI_VERSION} \
https://github.com/comfy-org/ComfyUI.git /ComfyUI
# Create venv and install all Python dependencies
ENV VIRTUAL_ENV=/opt/venv
RUN uv venv $VIRTUAL_ENV
RUN uv pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu && \
uv pip install -r /ComfyUI/requirements.txt && \
uv pip install wait-for-it
# Stage 2: Final image with Playwright
FROM mcr.microsoft.com/playwright:v1.61.1-noble
# Install fonts to match GitHub Actions runner (curl/unzip needed by the fnm installer)
RUN apt-get update && \
apt-get install -y --no-install-recommends \
ca-certificates curl unzip \
fonts-dejavu-core fonts-noto-core fonts-noto-cjk fonts-ubuntu && \
rm -rf /var/lib/apt/lists/*
# Node follows the caller's .nvmrc via fnm (25 pre-installed as the offline
# default; .nvmrc wins at runtime via `fnm use`). Corepack manages pnpm from the
# repo's packageManager field. Node 25 no longer bundles Corepack, so install it.
ENV FNM_DIR=/opt/fnm PATH="/opt/fnm/aliases/default/bin:$PATH"
RUN curl -fsSL https://fnm.vercel.app/install | bash -s -- --install-dir /usr/local/bin --skip-shell \
&& fnm install 25 && fnm default 25 \
&& npm i -g corepack@latest && corepack enable \
&& chmod -R a+w /opt/fnm
# Copy venv and ComfyUI from builder
COPY --from=builder /opt/venv /opt/venv
COPY --from=builder /ComfyUI /ComfyUI
# Fix venv Python symlinks to point to system Python (builder used /usr/local/bin/python)
RUN ln -sf /usr/bin/python3 /opt/venv/bin/python && \
ln -sf python /opt/venv/bin/python3 && \
ln -sf python /opt/venv/bin/python3.12
# Set up Python paths
ENV PATH="/opt/venv/bin:$PATH"
ENV VIRTUAL_ENV="/opt/venv"
# Create devtools directory (for mounting/copying at runtime)
RUN mkdir -p /ComfyUI/custom_nodes/ComfyUI_devtools
# Set ownership for pwuser (from Playwright base image)
RUN mkdir -p /app && chown -R pwuser:pwuser /ComfyUI /opt/venv /app
USER pwuser
WORKDIR /app