refactor(dockerfile): Update Node.js version and simplify Docker build process
Some checks failed
continuous-integration/drone/push Build is failing
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:
parent
e7c79e1d4a
commit
07a8247b89
23
Dockerfile
23
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"]
|
Loading…
Reference in New Issue
Block a user