fix: 极简化 CI/CD 工作流 - 让 Docker 处理所有构建
## 问题 - Runner 容器缺少 curl、node 等工具 - 在 Runner 容器中安装依赖复杂且不稳定 ## 解决方案 - 移除所有 Node.js 安装和构建步骤 - 直接执行 docker-compose build - 在 Dockerfile 中处理依赖安装和构建 - CI/CD 只负责部署流程控制 ## 工作流程(极简) 1. docker-compose down(停止旧容器) 2. docker-compose build(构建新镜像,包含依赖安装和编译) 3. docker-compose up(启动新容器) ## 优点 - 工作流极简,只有部署逻辑 - 所有构建在 Docker 镜像中完成 - 不依赖 Runner 容器的环境 - 更稳定,更容易维护 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -10,36 +10,9 @@ env:
|
||||
NODE_ENV: production
|
||||
|
||||
jobs:
|
||||
build-and-deploy:
|
||||
deploy:
|
||||
runs-on: [self-hosted, rent-deploy]
|
||||
steps:
|
||||
- name: Setup Node.js
|
||||
run: |
|
||||
which node || (curl -fsSL https://deb.nodesource.com/setup_18.x | bash - && apt-get install -y nodejs)
|
||||
which pnpm || npm install -g pnpm
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
pnpm config set store-dir .pnpm-store
|
||||
pnpm install --frozen-lockfile
|
||||
|
||||
- name: Build shared packages
|
||||
run: |
|
||||
pnpm --filter @rent/shared-types build
|
||||
pnpm --filter @rent/shared-utils build
|
||||
|
||||
- name: Build server
|
||||
run: pnpm --filter @rent/server build
|
||||
|
||||
- name: Build merchant-admin
|
||||
run: pnpm --filter @rent/merchant-admin build
|
||||
|
||||
- name: Build platform-admin
|
||||
run: pnpm --filter @rent/platform-admin build
|
||||
|
||||
- name: Build website
|
||||
run: pnpm --filter @rent/official-website build
|
||||
|
||||
- name: Deploy to test
|
||||
if: github.ref == 'refs/heads/test'
|
||||
run: |
|
||||
|
||||
Reference in New Issue
Block a user