refactor(dockerfile): Update Node.js version and simplify Docker build process
Some checks failed
continuous-integration/drone/push Build is failing

- 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
This commit is contained in:
lixin 2025-01-25 10:48:37 +08:00
parent e7c79e1d4a
commit 07a8247b89

View File

@ -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"]