22 lines
448 B
Docker
22 lines
448 B
Docker
FROM node:20-alpine as builder
|
|
|
|
WORKDIR /app
|
|
|
|
# 安装依赖(使用淘宝镜像)
|
|
COPY frontend/package*.json ./
|
|
RUN npm config set registry https://registry.npmmirror.com && npm ci
|
|
|
|
# 构建
|
|
COPY frontend/ .
|
|
RUN npm run build
|
|
|
|
# 生产镜像
|
|
FROM nginx:alpine
|
|
|
|
COPY --from=builder /app/dist /usr/share/nginx/html
|
|
COPY deploy/nginx/frontend.conf /etc/nginx/conf.d/default.conf
|
|
|
|
EXPOSE 80
|
|
|
|
CMD ["nginx", "-g", "daemon off;"]
|