-
-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathDockerfile
More file actions
129 lines (108 loc) · 4.59 KB
/
Dockerfile
File metadata and controls
129 lines (108 loc) · 4.59 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
FROM nvidia/cuda:12.8.1-runtime-ubuntu22.04
ARG BUILDPLATFORM
ARG TARGETPLATFORM
ENV DEBIAN_FRONTEND=noninteractive \
TZ=Etc/UTC \
WORKSPACE_ROOT=/workspace \
JUPYTER_PORT=8888 \
CODE_SERVER_PORT=8443 \
COMFY_PORT=5555 \
KOHYA_PORT=6666 \
INVOKE_PORT=9090 \
DIFFPIPE_PORT=4444 \
AI_TOOLKIT_PORT=8675 \
HOME=/workspace/home/root \
SHELL=/bin/bash \
HF_HUB_ENABLE_HF_TRANSFER=1 \
HF_XET_HIGH_PERFORMANCE=1 \
UMASK=0022
ENV PIP_DISABLE_PIP_VERSION_CHECK=1 \
PIP_NO_CACHE_DIR=1 \
XDG_CACHE_HOME=/workspace/home/root/.cache \
XDG_CONFIG_HOME=/workspace/home/root/.config \
XDG_DATA_HOME=/workspace/home/root/.local/share
ARG INSTALL_GPU_STACK=1
ARG INSTALL_COMFY=1
ARG INSTALL_KOHYA=1
ARG INSTALL_INVOKE=1
ARG INSTALL_DIFFPIPE=1
ARG INSTALL_AI_TOOLKIT=1
ARG INSTALL_AI_TOOLKIT_UI=1
ARG INSTALL_COPILOT_CLI=1
ARG COPILOT_CLI_VERSION=1.0.10
ARG CODE_SERVER_VERSION=4.112.0
ARG JUPYTERLAB_VERSION=4.5.6
ARG IPYWIDGETS_VERSION=8.1.8
ARG COMFYUI_REF=v0.20.2
ARG COMFYUI_MANAGER_REF=4.2.1
ARG KOHYA_REF=v25.2.1
ARG DIFFPIPE_REF=535bc585391d7f7d861d5f8952f1e144bc997270
ARG AI_TOOLKIT_REF=6bb8acbffc2021cc009cc18491f00aa3800bf45a
ARG AI_TOOLKIT_DIFFUSERS_VERSION=git
ARG DIFFPIPE_DIFFUSERS_VERSION=0.38.0
ARG DIFFPIPE_TRANSFORMERS_VERSION=4.57.6
ARG TORCH_VERSION=2.8.0
ARG TORCHVISION_VERSION=0.23.0
ARG TORCHAUDIO_VERSION=2.8.0
ARG TORCH_INDEX_URL=https://download.pytorch.org/whl/cu128
ARG XFORMERS_VERSION=0.0.32.post2
ARG BITSANDBYTES_VERSION=0.49.2
ARG CORE_DIFFUSERS_VERSION=0.32.2
ARG TRANSFORMERS_VERSION=4.57.6
ARG PEFT_VERSION=0.19.1
ARG INVOKE_TORCH_VERSION=2.7.1
ARG INVOKE_TORCHVISION_VERSION=0.22.1
ARG INVOKE_TORCHAUDIO_VERSION=2.7.1
ARG INVOKE_TORCH_INDEX_URL=https://download.pytorch.org/whl/cu128
ARG INVOKEAI_VERSION=6.12.0
ARG INVOKE_DIFFUSERS_VERSION=0.36.0
ARG INVOKE_TRANSFORMERS_VERSION=4.57.6
ARG INVOKE_ACCELERATE_VERSION=1.13.0
ARG INVOKE_HF_HUB_VERSION=0.36.2
ARG CUDA_NVCC_PKG=cuda-nvcc-12-8
ARG CROC_VERSION=10.4.2
# ----- LAYER 1: Copy build scripts (stable) -----
COPY scripts/build /opt/pilot/build
RUN find /opt/pilot/build -type f -name '*.sh' -exec chmod +x {} +
# ----- LAYER 2: System + Python (stable, rarely changes) -----
RUN /opt/pilot/build/install-system-tools.sh && \
/opt/pilot/build/install-base-python.sh && \
/opt/pilot/build/install-code-server.sh && \
/opt/pilot/build/install-copilot-cli.sh
# ----- LAYER 3: Python venv setup + constraints (stable) -----
RUN /opt/pilot/build/create-venvs.sh && \
/opt/pilot/build/write-constraints.sh /opt/pilot/config
# ----- LAYER 4: Core PyTorch/ML stack (semi-stable, use ARG for cache busting) -----
# Cache key: explicitly reference PyTorch/core versions
ARG TORCH_CACHE_BUST="${TORCH_VERSION}-${TORCHVISION_VERSION}-${XFORMERS_VERSION}"
RUN /opt/pilot/build/install-core-stack.sh
# ----- LAYER 5-9: Service installs (variable frequency, separated by service) -----
# These layers rebuild independently when service refs change
ARG COMFY_CACHE_BUST="${COMFYUI_REF}-${COMFYUI_MANAGER_REF}"
RUN if [ "${INSTALL_COMFY:-1}" = "1" ]; then /opt/pilot/build/install-comfy.sh; fi
ARG KOHYA_CACHE_BUST="${KOHYA_REF}"
RUN if [ "${INSTALL_KOHYA:-1}" = "1" ]; then /opt/pilot/build/install-kohya.sh; fi
ARG DIFFPIPE_CACHE_BUST="${DIFFPIPE_REF}-${DIFFPIPE_DIFFUSERS_VERSION}"
RUN if [ "${INSTALL_DIFFPIPE:-1}" = "1" ]; then /opt/pilot/build/install-diffpipe.sh; fi
ARG INVOKE_CACHE_BUST="${INVOKEAI_VERSION}-${INVOKE_TORCH_VERSION}"
RUN if [ "${INSTALL_INVOKE:-1}" = "1" ]; then /opt/pilot/build/install-invoke.sh; fi
ARG AI_TOOLKIT_CACHE_BUST="${AI_TOOLKIT_REF}"
RUN if [ "${INSTALL_AI_TOOLKIT:-1}" = "1" ]; then /opt/pilot/build/install-ai-toolkit.sh; fi
# ----- LAYER 10: Config + runtime setup (semi-stable) -----
COPY config/env.defaults /opt/pilot/config/env.defaults
COPY config/models.manifest /opt/pilot/config/models.manifest.default
COPY supervisor/supervisord.conf /etc/supervisor/supervisord.conf
COPY scripts/*.sh scripts/*.py /opt/pilot/
COPY scripts/pilot /usr/local/bin/pilot
RUN echo 'source /opt/venvs/core/bin/activate' > /etc/profile.d/core-venv.sh && \
chmod 644 /etc/profile.d/core-venv.sh && \
/opt/pilot/build/finalize-runtime.sh
# ----- LAYER 11: Documentation (volatile, copied late) -----
COPY README.md /opt/pilot/README.md
COPY CHANGELOG /opt/pilot/CHANGELOG
# ----- LAYER 12: App source code (most volatile, copied last) -----
COPY apps /opt/pilot/apps
COPY docs /opt/pilot/docs
EXPOSE 7878 8888 8443 5555 6666 9090 4444 8675
ENTRYPOINT ["/usr/bin/tini","-s","--"]
CMD ["/bin/bash", "-lc", "/opt/pilot/bootstrap.sh && exec /usr/bin/supervisord -n -c /etc/supervisor/supervisord.conf"]