chore: 优化流水线
This commit is contained in:
parent
3a33609c69
commit
7b155f29f9
37
.cnb.yml
37
.cnb.yml
@ -14,25 +14,30 @@ main:
|
|||||||
web_trigger_test:
|
web_trigger_test:
|
||||||
- docker:
|
- docker:
|
||||||
image: node:22-slim
|
image: node:22-slim
|
||||||
volumes:
|
|
||||||
- /pnpm/store
|
|
||||||
imports: https://cnb.cool/risenstars/iot-env/-/blob/main/env.yml
|
imports: https://cnb.cool/risenstars/iot-env/-/blob/main/env.yml
|
||||||
stages:
|
stages:
|
||||||
- name: npm i -g corepack
|
- name: build cach image
|
||||||
script: |
|
type: docker:cache
|
||||||
npm config set registry https://mirrors.cloud.tencent.com/npm/
|
options:
|
||||||
npm i -g corepack
|
dockerfile: cache.dockerfile
|
||||||
- name: pnpm install
|
by:
|
||||||
script: |
|
- package.json
|
||||||
pnpm config set registry https://mirrors.cloud.tencent.com/npm/
|
- package-lock.json
|
||||||
pnpm install --frozen-lockfile
|
versionBy:
|
||||||
|
- package-lock.json
|
||||||
|
exports:
|
||||||
|
name: DOCKER_CACHE_IMAGE_NAME
|
||||||
|
|
||||||
|
- name: use cache
|
||||||
|
image: $DOCKER_CACHE_IMAGE_NAME
|
||||||
|
commands:
|
||||||
|
- cp -r /.pnpm-store ./.pnpm-store
|
||||||
|
- name: build with cache
|
||||||
|
script:
|
||||||
|
- mv ./apps/web-tdesign/.env.production ./apps/web-tdesign/.env.production.back
|
||||||
|
- mv ./apps/web-tdesign/.env.pre ./apps/web-tdesign/.env.production
|
||||||
|
- pnpm run build:tdesign
|
||||||
|
|
||||||
- name: pnpm run build
|
|
||||||
script: pnpm run build
|
|
||||||
|
|
||||||
- name: pnpm run build:tdesign:pre
|
|
||||||
script: pnpm run build:tdesign:pre
|
|
||||||
|
|
||||||
- name: 使用 rsync 复制文件
|
- name: 使用 rsync 复制文件
|
||||||
image: tencentcom/rsync
|
image: tencentcom/rsync
|
||||||
settings:
|
settings:
|
||||||
|
|||||||
22
cache.dockerfile
Normal file
22
cache.dockerfile
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
FROM node:22-slim AS builder
|
||||||
|
|
||||||
|
# --max-old-space-size
|
||||||
|
ENV PNPM_HOME="/pnpm"
|
||||||
|
ENV PATH="$PNPM_HOME:$PATH"
|
||||||
|
ENV NODE_OPTIONS=--max-old-space-size=8192
|
||||||
|
ENV TZ=Asia/Shanghai
|
||||||
|
|
||||||
|
RUN npm i -g corepack
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
# copy package.json and pnpm-lock.yaml to workspace
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
# 安装依赖
|
||||||
|
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile
|
||||||
|
|
||||||
|
RUN echo "Builder Success 🎉"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Loading…
Reference in New Issue
Block a user