From 07a8247b898f0e5e64235036ed455fecaaf42e90 Mon Sep 17 00:00:00 2001 From: lixin <2967839139@qq.com> Date: Sat, 25 Jan 2025 10:48:37 +0800 Subject: [PATCH] refactor(dockerfile): Update Node.js version and simplify Docker build process - Changed base image from node:22-alpine to node:18-alpine - Simplified Dockerfile by removing redundant comments - Streamlined dependency installation and build steps - Maintained pnpm as package manager --- Dockerfile | 23 +++++------------------ 1 file changed, 5 insertions(+), 18 deletions(-) diff --git a/Dockerfile b/Dockerfile index 7b86c89..9a50621 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,26 +1,13 @@ - -1. 首先创建 `Dockerfile`: - -```dockerfile -FROM node:22-alpine +FROM node:18-alpine WORKDIR /app -# 安装 pnpm -RUN npm config set registry https://registry.npmmirror.com && \ - npm install -g pnpm && \ - pnpm config set registry https://registry.npmmirror.com - -# 复制项目文件 +COPY package.json pnpm-lock.yaml ./ COPY . . -# 安装依赖 -RUN pnpm install - -# 构建项目 -RUN pnpm run build +RUN npm install -g pnpm && \ + pnpm install EXPOSE 8001 -CMD ["pnpm", "start"] -``` +CMD ["pnpm", "start"] \ No newline at end of file