feat: dev

This commit is contained in:
2026-06-01 18:22:30 +08:00
parent f021b43f05
commit 0bbbe20ec7
20 changed files with 9493 additions and 11427 deletions
+111
View File
@@ -0,0 +1,111 @@
stages:
- install
- build
- deploy
variables:
NODE_ENV: production
# 仅 prod 分支触发
workflow:
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
when: never
- if: $CI_COMMIT_BRANCH == "prod"
# pnpm store 缓存
cache:
key:
files:
- pnpm-lock.yaml
paths:
- .pnpm-store
# ==================== INSTALL ====================
install_dependencies:
stage: install
tags:
- rent-deploy
script:
- npm install -g pnpm
- pnpm config set store-dir .pnpm-store
- pnpm install --frozen-lockfile
artifacts:
paths:
- node_modules/
- apps/*/node_modules/
- packages/*/node_modules/
expire_in: 1 hour
# ==================== BUILD ====================
build_server:
stage: build
tags:
- rent-deploy
needs: [install_dependencies]
script:
- npm install -g pnpm
- pnpm config set store-dir .pnpm-store
- pnpm --filter @rent/shared-types build
- pnpm --filter @rent/shared-utils build
- pnpm --filter @rent/server build
artifacts:
paths:
- apps/server/dist/
expire_in: 1 hour
build_merchant:
stage: build
tags:
- rent-deploy
needs: [install_dependencies]
script:
- npm install -g pnpm
- pnpm config set store-dir .pnpm-store
- pnpm --filter @rent/shared-types build
- pnpm --filter @rent/shared-utils build
- pnpm --filter @rent/merchant-admin build
artifacts:
paths:
- apps/merchant-admin/dist/
expire_in: 1 hour
build_platform:
stage: build
tags:
- rent-deploy
needs: [install_dependencies]
script:
- npm install -g pnpm
- pnpm config set store-dir .pnpm-store
- pnpm --filter @rent/shared-types build
- pnpm --filter @rent/shared-utils build
- pnpm --filter @rent/platform-admin build
artifacts:
paths:
- apps/platform-admin/dist/
expire_in: 1 hour
# ==================== DEPLOY ====================
deploy_production:
stage: deploy
tags:
- rent-deploy
needs:
- build_server
- build_merchant
- build_platform
script:
- echo "部署到生产环境..."
- cd deploy/docker
- docker-compose down --remove-orphans
- docker-compose build --parallel
- docker-compose up -d
- docker image prune -f
- echo "等待服务启动..."
- sleep 10
- docker-compose ps
environment:
name: production
only:
- prod