Skip to content

Commit 7ef3ce6

Browse files
committed
Docker: 使用预编译的 pydensecrf wheel 加速构建
- 从 GitHub Release 下载预编译的 pydensecrf wheel - 避免在 Docker 构建时从源码编译,大幅减少构建时间 - wheel 文件: pydensecrf-1.0-cp312-cp312-linux_x86_64.whl
1 parent 22586ef commit 7ef3ce6

1 file changed

Lines changed: 7 additions & 6 deletions

File tree

packaging/Dockerfile

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,18 +62,19 @@ WORKDIR /app
6262
# 复制项目文件
6363
COPY . /app/
6464

65+
# 下载预编译的 pydensecrf wheel(从 GitHub Release)
66+
RUN wget -q https://github.com/hgmzhn/manga-translator-ui/releases/download/v1.9.2/pydensecrf-1.0-cp312-cp312-linux_x86_64.whl -O /tmp/pydensecrf.whl
67+
6568
# 安装 Python 依赖
6669
ARG BUILD_TYPE=cpu
6770
RUN if [ "$BUILD_TYPE" = "gpu" ]; then \
68-
# GPU 版本:先安装 pydensecrf 从源码,然后安装其他依赖
69-
pip install --no-cache-dir Cython numpy && \
70-
pip install --no-cache-dir git+https://github.com/lucasb-eyer/pydensecrf.git && \
71+
# GPU 版本:先安装预编译的 pydensecrf,然后安装其他依赖
72+
pip install --no-cache-dir /tmp/pydensecrf.whl && \
7173
grep -v "pydensecrf" requirements_gpu.txt > /tmp/requirements_gpu_no_pydensecrf.txt && \
7274
pip install --no-cache-dir -r /tmp/requirements_gpu_no_pydensecrf.txt; \
7375
else \
74-
# CPU 版本:先安装 pydensecrf 从源码,然后安装其他依赖
75-
pip install --no-cache-dir Cython numpy && \
76-
pip install --no-cache-dir git+https://github.com/lucasb-eyer/pydensecrf.git && \
76+
# CPU 版本:先安装预编译的 pydensecrf,然后安装其他依赖
77+
pip install --no-cache-dir /tmp/pydensecrf.whl && \
7778
grep -v "pydensecrf" requirements_cpu.txt > /tmp/requirements_cpu_no_pydensecrf.txt && \
7879
pip install --no-cache-dir -r /tmp/requirements_cpu_no_pydensecrf.txt; \
7980
fi

0 commit comments

Comments
 (0)