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
21
Dockerfile
21
Dockerfile
@ -1,26 +1,13 @@
|
|||||||
|
FROM node:18-alpine
|
||||||
1. 首先创建 `Dockerfile`:
|
|
||||||
|
|
||||||
```dockerfile
|
|
||||||
FROM node:22-alpine
|
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
# 安装 pnpm
|
COPY package.json pnpm-lock.yaml ./
|
||||||
RUN npm config set registry https://registry.npmmirror.com && \
|
|
||||||
npm install -g pnpm && \
|
|
||||||
pnpm config set registry https://registry.npmmirror.com
|
|
||||||
|
|
||||||
# 复制项目文件
|
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
# 安装依赖
|
RUN npm install -g pnpm && \
|
||||||
RUN pnpm install
|
pnpm install
|
||||||
|
|
||||||
# 构建项目
|
|
||||||
RUN pnpm run build
|
|
||||||
|
|
||||||
EXPOSE 8001
|
EXPOSE 8001
|
||||||
|
|
||||||
CMD ["pnpm", "start"]
|
CMD ["pnpm", "start"]
|
||||||
```
|
|
||||||
|
Loading…
Reference in New Issue
Block a user