Files
simapi-vue3-template/Dockerfile
T
2026-08-10 22:05:18 +08:00

23 lines
748 B
Docker

ARG VERSION=0.0.0
# 构建阶段使用 Node.js
FROM registry.cn-heyuan.aliyuncs.com/vector-flow/node:20-alpine AS build-stage
# 设置工作目录
ARG VERSION
WORKDIR /app
# 复制 package.json 和 package-lock.json
COPY ./ ./
# 安装依赖
RUN npm ci --registry=https://registry.npmmirror.com
RUN npm pkg set version=${VERSION}
# 构建应用
RUN npm run build
# 生产阶段使用 Nginx
FROM registry.cn-heyuan.aliyuncs.com/vector-flow/nginx:stable-alpine AS production-stage
# 复制构建好的文件到 Nginx 服务目录
COPY --from=build-stage /app/dist /usr/share/nginx/html
# 复制自定义 Nginx 配置文件
COPY ./nginx.conf /etc/nginx/conf.d/default.conf
# 暴露 80 端口
EXPOSE 80
# 运行 Nginx
CMD ["nginx", "-g", "daemon off;"]