This commit is contained in:
aaron 2025-04-25 11:31:34 +08:00
parent 4408899e97
commit 18971cc9eb

View File

@ -13,7 +13,7 @@ COPY package*.json ./
# 安装依赖 # 安装依赖
RUN npm install RUN npm install
# 复制所有源代码 # 复制项目文件
COPY . . COPY . .
# 构建应用 # 构建应用
@ -22,9 +22,12 @@ RUN npm run build
# 生产阶段 # 生产阶段
FROM nginx:stable-alpine as production-stage FROM nginx:stable-alpine as production-stage
# 从构建阶段复制构建好的文件到nginx目录 # 将构建好的文件复制到nginx目录
COPY --from=build-stage /app/dist /usr/share/nginx/html COPY --from=build-stage /app/dist /usr/share/nginx/html
# 复制nginx配置文件
COPY nginx.conf /etc/nginx/conf.d/default.conf
# 暴露80端口 # 暴露80端口
EXPOSE 80 EXPOSE 80