From 092e763a05ff61bef2eb1a879e9fbcc22d927842 Mon Sep 17 00:00:00 2001 From: cheney Date: Sun, 5 Apr 2026 21:01:12 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=20dockerfile?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/Dockerfile b/Dockerfile index dfc5be7..a383411 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ # 构建阶段 -FROM node:18-alpine as builder +FROM node:18-alpine AS builder # 设置工作目录 WORKDIR /app @@ -7,8 +7,8 @@ WORKDIR /app # 复制package.json和package-lock.json COPY package*.json ./ -# 安装依赖 -RUN npm install +# 设置淘宝源并安装依赖 +RUN npm config set registry https://registry.npmmirror.com && npm install # 复制项目文件 COPY . . @@ -25,10 +25,11 @@ WORKDIR /app # 复制必要的文件 COPY --from=builder /app/package*.json ./ COPY --from=builder /app/.next ./.next -COPY --from=builder /app/public ./public +# 复制public目录(如果存在) +COPY --from=builder /app/public* ./public/ -# 安装生产依赖 -RUN npm install --only=production +# 设置淘宝源并安装生产依赖 +RUN npm config set registry https://registry.npmmirror.com && npm install --only=production # 暴露3000端口 EXPOSE 3000