fix(docker): apk 默认走阿里云镜像(国内构建实测官方源单包 30~40s)

This commit is contained in:
zqlit committed 2026-10-04 21:33:39 +08:00
1 parent c217d20c30
commit e8d13b9a6e
1 file changed
+9 -1
+9 -1
View File
@@ -10,7 +10,15 @@
FROM node:22-alpine
# git:发布用。ca-certificates:https 远端(CNB / GitHub)要它
RUN apk add --no-cache git ca-certificates
#
# ★ apk 源默认换成阿里云镜像:国内机器直连 dl-cdn.alpinelinux.org 实测慢到不可用
# (单个包 30~40 秒,12 个包要 7 分钟),换源后几秒装完。
# 境外机器想用官方源就 --build-arg APK_MIRROR= 传空值。
ARG APK_MIRROR=mirrors.aliyun.com
RUN if [ -n "$APK_MIRROR" ]; then \
sed -i "s#dl-cdn.alpinelinux.org#$APK_MIRROR#g" /etc/apk/repositories; \
fi \
&& apk add --no-cache git ca-certificates
WORKDIR /app
ENV NODE_ENV=production