Files
backend/frontend/Dockerfile.prod
T

17 lines
552 B
Docker
Raw Normal View History

# 构建加速(2026-08-10):腾讯 npm 源 + npm ci(依赖 lockfile 精确安装)
# syntax=docker/dockerfile:1
FROM node:20-alpine AS builder
WORKDIR /app
# 腾讯 npm 镜像(内网可达,快)
RUN npm config set registry https://mirrors.cloud.tencent.com/npm/
COPY package.json package-lock.json ./
RUN --mount=type=cache,target=/root/.npm npm ci
COPY . .
RUN npm run build
FROM nginx:alpine
COPY --from=builder /app/dist /usr/share/nginx/html
COPY nginx.conf /etc/nginx/conf.d/default.conf
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]