From 92061fdb4ddd7d5cfc36a94de4326539d73030c7 Mon Sep 17 00:00:00 2001 From: aaron <> Date: Sun, 9 Mar 2025 10:26:27 +0800 Subject: [PATCH] update --- Dockerfile | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Dockerfile b/Dockerfile index 0c0c55a..598d109 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,9 @@ # 构建阶段 FROM node:18-alpine as build-stage +# 切换 Alpine 镜像源为阿里云 +RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories + # 设置环境变量 ARG NODE_ENV ENV NODE_ENV=${NODE_ENV} @@ -8,6 +11,10 @@ ENV NODE_ENV=${NODE_ENV} # 安装 yarn RUN apk add --no-cache yarn +# 设置 yarn 和 npm 镜像源为淘宝源 +RUN yarn config set registry https://registry.npmmirror.com && \ + npm config set registry https://registry.npmmirror.com + # 设置工作目录 WORKDIR /app @@ -26,6 +33,9 @@ RUN yarn build # 生产阶段 FROM nginx:stable-alpine as production-stage +# 切换 Alpine 镜像源为阿里云 +RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories + # 复制构建结果到Nginx目录 COPY --from=build-stage /app/dist /usr/share/nginx/html