Repository navigation
Expand file tree
/
Copy pathDockerfile
More file actions
53 lines (44 loc) · 1.91 KB
/
Copy pathDockerfile
File metadata and controls
53 lines (44 loc) · 1.91 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
ARG PYTORCH_IMAGE=pytorch/pytorch:2.14.1-cuda13.0-cudnn9-runtime
FROM node:22-bookworm-slim AS frontend-build
WORKDIR /build/frontend
RUN npm install --global pnpm@10.26.2
COPY frontend/package.json frontend/pnpm-lock.yaml ./
RUN pnpm install --frozen-lockfile
COPY frontend/src ./src
COPY frontend/index.html frontend/tsconfig.json frontend/vite.config.ts ./
COPY version.json /build/version.json
RUN pnpm run build
FROM ${PYTORCH_IMAGE}
ARG CUDA_FLAVOR=cu130
EXPOSE 28000
ENV TZ=Asia/Shanghai \
HF_HOME=/app/lora-scripts/huggingface \
PYTHONUTF8=1 \
PYTHONUNBUFFERED=1
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime \
&& echo $TZ > /etc/timezone \
&& apt-get update \
&& apt-get install --no-install-recommends -y git python3-tk libgl1 libglib2.0-0 \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app/lora-scripts
COPY requirements.txt ./
COPY requirements ./requirements
RUN case "$CUDA_FLAVOR" in cu130|cu128) ;; *) echo "CUDA_FLAVOR must be cu130 or cu128" >&2; exit 1 ;; esac \
&& python -m pip install --no-cache-dir --upgrade -r requirements/tooling.txt \
&& python -m pip install --no-cache-dir --upgrade \
--index-url "https://download.pytorch.org/whl/${CUDA_FLAVOR}" \
-r "requirements/pytorch-${CUDA_FLAVOR}.txt" \
&& python -m pip install --no-cache-dir -r requirements.txt \
-r requirements/tooling.txt \
-r "requirements/onnxruntime-${CUDA_FLAVOR}.txt" \
-c "requirements/pytorch-${CUDA_FLAVOR}.txt"
# Package this checkout; local environments, weights and training data stay outside the image.
COPY gui.py version.json LICENSE ./
COPY mikazuki ./mikazuki
COPY scripts ./scripts
COPY docs ./docs
COPY assets/favicon.ico ./assets/favicon.ico
COPY huggingface/accelerate ./huggingface/accelerate
COPY --from=frontend-build /build/frontend/dist ./frontend/dist
RUN mkdir -p config models train output logs huggingface
CMD ["python", "gui.py", "--listen"]