构建提速:apt/pip/npm 默认走腾讯云镜像(可用 build-arg 覆盖)
- executor/Dockerfile: ARG DEBIAN_MIRROR 换 apt 源(grep 扫 /etc/apt 下两种源文件格式,只替换域名);ARG PIP_INDEX_URL 并以 ENV 烘进镜像,运行期 pip --target 也走镜像 - executor/Dockerfile: 基础阶段补 DEBIAN_FRONTEND=noninteractive(避免无 TTY 下 apt 交互式提问把构建挂死) - app/Dockerfile: ARG NPM_REGISTRY + npm config set registry - docs/DEPLOY.md: 补一行构建源说明与覆盖方式
This commit is contained in:
+6
-1
@@ -4,8 +4,13 @@ ENV TZ=Asia/Shanghai
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# 国内构建慢:npm 默认源在国外。默认换成腾讯云 npm 镜像(与宿主机 ~/.npmrc 一致)。
|
||||
# 想换回官方:docker compose build --build-arg NPM_REGISTRY=https://registry.npmjs.org/
|
||||
ARG NPM_REGISTRY=https://mirrors.cloud.tencent.com/npm/
|
||||
|
||||
COPY package.json package-lock.json ./
|
||||
RUN npm install --omit=dev --no-audit --no-fund
|
||||
RUN npm config set registry "$NPM_REGISTRY" \
|
||||
&& npm install --omit=dev --no-audit --no-fund
|
||||
|
||||
COPY server ./server
|
||||
COPY config.example.yml ./
|
||||
|
||||
Reference in New Issue
Block a user