build(Dockerfile): 使用 pnpm 替代 npm 安装依赖
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
- 全局安装 pnpm - 配置 pnpm 使用国内代理 - 使用 pnpm 安装生产环境依赖 - 移除 npm 相关代码
This commit is contained in:
parent
9c97d2dc3b
commit
eecc828ac0
@ -17,14 +17,15 @@ RUN npm config set registry https://registry.npmmirror.com
|
|||||||
|
|
||||||
# 安装开发期依赖
|
# 安装开发期依赖
|
||||||
COPY package.json ./package.json
|
COPY package.json ./package.json
|
||||||
RUN npm install
|
RUN npm install -g pnpm
|
||||||
|
RUN pnpm config set registry https://registry.npmmirror.com
|
||||||
# 构建项目
|
# 构建项目
|
||||||
COPY . .
|
COPY . .
|
||||||
RUN npm run build
|
RUN npm run build
|
||||||
# 删除开发期依赖
|
# 删除开发期依赖
|
||||||
RUN rm -rf node_modules && rm package-lock.json
|
RUN rm -rf node_modules && rm package-lock.json
|
||||||
# 安装生产环境依赖
|
# 安装生产环境依赖
|
||||||
RUN npm install --production
|
RUN pnpm install
|
||||||
|
|
||||||
# 如果端口更换,这边可以更新一下
|
# 如果端口更换,这边可以更新一下
|
||||||
EXPOSE 8001
|
EXPOSE 8001
|
||||||
|
Loading…
Reference in New Issue
Block a user