update
This commit is contained in:
parent
e4c2b44ea4
commit
92061fdb4d
10
Dockerfile
10
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
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user