first commit
This commit is contained in:
32
frontend/Dockerfile.prod.simple
Normal file
32
frontend/Dockerfile.prod.simple
Normal file
@@ -0,0 +1,32 @@
|
||||
# 构建阶段
|
||||
FROM crpi-x2l5uviq1k8hji3c.ap-northeast-1.personal.cr.aliyuncs.com/yipaidocker-images/linux_arm64_node:18-alpine AS builder
|
||||
|
||||
# 设置npm镜像源
|
||||
RUN npm config set registry http://host.docker.internal:4873/
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# 复制package文件并安装依赖
|
||||
COPY package*.json ./
|
||||
RUN npm install --legacy-peer-deps
|
||||
|
||||
# 复制源代码
|
||||
COPY . .
|
||||
|
||||
# 构建应用
|
||||
RUN npm run build
|
||||
|
||||
# 运行阶段
|
||||
FROM crpi-x2l5uviq1k8hji3c.ap-northeast-1.personal.cr.aliyuncs.com/yipaidocker-images/linux_amd64_nginx:alpine
|
||||
|
||||
# 复制构建产物到nginx目录
|
||||
COPY --from=builder /app/dist /usr/share/nginx/html
|
||||
|
||||
# 复制nginx配置
|
||||
COPY nginx.conf /etc/nginx/nginx.conf
|
||||
|
||||
# 暴露端口
|
||||
EXPOSE 80
|
||||
|
||||
# 启动nginx
|
||||
CMD ["nginx", "-g", "daemon off;"]
|
||||
Reference in New Issue
Block a user