Files
django-vue3-admin/web/Dockerfile
T

26 lines
627 B
Docker
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 第一阶段:构建
FROM node:20-alpine as builder
WORKDIR /web
# 安装 pnpm
RUN npm install -g pnpm --registry=https://registry.npmmirror.com
# 先复制 package.json 和 pnpm-lock.yamlbuild context 是项目根目录)
COPY web/package.json web/pnpm-lock.yaml* ./
# 安装依赖(利用缓存)
RUN pnpm install --registry=https://registry.npmmirror.com --frozen-lockfile
# 复制源代码
COPY web/ .
# 构建
RUN pnpm build
# 第二阶段:Nginx 运行时
FROM docker.1ms.run/nginx:alpine
# nginx.conf 由 docker-compose volumes 映射,无需复制
COPY --from=builder /web/dist /usr/share/nginx/html