加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
Dockerfile 649 Bytes
一键复制 编辑 原始数据 按行查看 历史
# https://stackoverflow.com/questions/53681522/share-variable-in-multi-stage-dockerfile-arg-before-from-not-substituted
ARG PROJECT_DIR=/vue3-antdv-admin
FROM node:20-slim as builder
ARG PROJECT_DIR
WORKDIR $PROJECT_DIR
# 安装pnpm
RUN npm install -g pnpm
COPY . ./
# 安装依赖
# 若网络不通,可以使用淘宝源
# RUN pnpm config set registry https://registry.npmmirror.com
RUN pnpm install
# 构建项目
ENV VITE_BASE_URL=/
RUN pnpm build
FROM nginx:alpine as production
ARG PROJECT_DIR
COPY --from=builder $PROJECT_DIR/dist/ /usr/share/nginx/html
# COPY --from=builder $PROJECT_DIR/nginx.conf /etc/nginx/nginx.conf
EXPOSE 80
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化