From fe7fb218e94bf65413da777c022eddf4e3f0ff46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=87=E9=98=B3?= Date: Tue, 26 Nov 2024 21:28:39 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=EF=BC=9ADockerFile=E8=84=9A?= =?UTF-8?q?=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dockerfile | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/dockerfile b/dockerfile index 61f1f6a..649b00d 100644 --- a/dockerfile +++ b/dockerfile @@ -1,11 +1,11 @@ # 使用官方的Node.js镜像作为基础镜像 -FROM node:20-alpine +FROM node:20-alpine AS builder # 设置工作目录 WORKDIR /thrive # 复制 package.json 和 package-lock.json -COPY package*.json /thrive/ +COPY package*.json ./ # 配置 npm 镜像源 RUN npm config set registry https://registry.npmmirror.com @@ -14,7 +14,7 @@ RUN npm config set registry https://registry.npmmirror.com RUN npm install # 复制项目文件 -COPY . /thrive +COPY . . # 构建项目 RUN npm run build @@ -23,10 +23,10 @@ RUN npm run build FROM nginx:alpine # 复制构建输出到 Nginx 的默认静态文件目录 -COPY --from=builder /app/dist /usr/share/nginx/html +COPY --from=builder /thrive/dist /usr/share/nginx/html # 暴露端口 -EXPOSE 9002 +EXPOSE 80 # 启动 Nginx CMD ["nginx", "-g", "daemon off;"]