blob: 20630b6844c18dcba5a16e138d92ecaa68a462e8 [file] [log] [blame]
# Build stage
FROM node:18-alpine AS build
WORKDIR /app
COPY package*.json ./
RUN npm install
COPY . .
RUN npm run build
# Production stage
FROM nginx:stable-alpine AS base
# 复制构建好的前端文件
COPY --from=build /app/dist /usr/share/nginx/html
# 关键:复制自定义的 nginx 配置文件
COPY nginx.conf /etc/nginx/conf.d/default.conf
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]