This commit is contained in:
hailin 2025-07-28 17:18:03 +08:00
parent 3a369ed46e
commit 8e83ecc94e
1 changed files with 8 additions and 4 deletions

View File

@ -22,12 +22,16 @@ WORKDIR /app
# 拷贝构建产物 # 拷贝构建产物
COPY --from=builder /app/.output .output COPY --from=builder /app/.output .output
# 安装生产依赖(如有) # 只拷贝必要的运行文件(不执行 yarn install
COPY package*.json yarn.lock ./ # 如果 Nuxt 构建产物已完整,可不再安装依赖
RUN yarn install --production --frozen-lockfile # COPY package*.json yarn.lock ./
# RUN yarn install --production --frozen-lockfile
# ✅ 安装 serve 用于启动 SSR 服务
RUN npm install -g serve
# 暴露端口 # 暴露端口
EXPOSE 8091 EXPOSE 8091
# 启动 Nuxt # 启动 Nuxt SSR 服务
CMD ["node", ".output/server/index.mjs"] CMD ["node", ".output/server/index.mjs"]