feat: 移除仓库内 nginx 并拆分前端运行时

This commit is contained in:
Cheng Zhou
2026-03-30 21:02:51 +08:00
parent 7ccb8c20cc
commit 27ba5eabff
22 changed files with 287 additions and 160 deletions
@@ -1,9 +1,9 @@
# Tencent Cloud Private Registry Design
**Goal:** Add CI that automatically builds and pushes private `backend` and `nginx` images to a self-hosted Docker Registry running on a Tencent Cloud CVM, with `dev` publishing test tags, `release` and `release/*` publishing release-candidate tags, and `main` publishing formal tags.
**Goal:** Add CI that automatically builds and pushes private `backend` and `frontend` images to a self-hosted Docker Registry running on a Tencent Cloud CVM, with `dev` publishing test tags, `release` and `release/*` publishing release-candidate tags, and `main` publishing formal tags.
**Decisions**
- Publish only two runtime images: `<registry-host>/ctms/ctms-backend` and `<registry-host>/ctms/ctms-nginx`.
- Publish only two runtime images: `<registry-host>/ctms/ctms-backend` and `<registry-host>/ctms/ctms-frontend`.
- Keep the private registry on the Tencent Cloud CVM as a self-hosted `registry:2` instance protected by `htpasswd`.
- Trigger automation on pushes to `dev`, `release`, `release/*`, and `main`.
- Use GitHub Actions only as the orchestrator. Actual Docker build and push happen on the Tencent Cloud server over SSH.
@@ -18,34 +18,33 @@
- A new GitHub Actions workflow triggers on pushes to `dev`, `release`, `release/*`, and `main`.
- The workflow authenticates to the Tencent Cloud server using SSH credentials stored in GitHub Secrets.
- The workflow syncs the repository contents to a fixed build directory such as `/opt/ctms-build/<repo>`.
- A server-local script logs in to the private registry, builds `backend` and `nginx`, applies branch-specific tags, and pushes the images to the registry.
- A server-local script logs in to the private registry, builds `backend` and `frontend`, applies branch-specific tags, and pushes the images to the registry.
**Registry Naming**
- Backend image: `<registry-host>/ctms/ctms-backend`
- Nginx image: `<registry-host>/ctms/ctms-nginx`
- `frontend` is intentionally not published because the current runtime topology already builds the frontend assets into the `nginx` image.
- Frontend image: `<registry-host>/ctms/ctms-frontend`
**Tagging Strategy**
- `dev` branch pushes publish:
- `<registry-host>/ctms/ctms-backend:dev-latest`
- `<registry-host>/ctms/ctms-backend:dev-<short_sha>`
- `<registry-host>/ctms/ctms-nginx:dev-latest`
- `<registry-host>/ctms/ctms-nginx:dev-<short_sha>`
- `<registry-host>/ctms/ctms-frontend:dev-latest`
- `<registry-host>/ctms/ctms-frontend:dev-<short_sha>`
- `release` branch pushes publish:
- `<registry-host>/ctms/ctms-backend:rc-release`
- `<registry-host>/ctms/ctms-backend:rc-<short_sha>`
- `<registry-host>/ctms/ctms-nginx:rc-release`
- `<registry-host>/ctms/ctms-nginx:rc-<short_sha>`
- `<registry-host>/ctms/ctms-frontend:rc-release`
- `<registry-host>/ctms/ctms-frontend:rc-<short_sha>`
- `release/*` branch pushes publish:
- `<registry-host>/ctms/ctms-backend:rc-<release-branch>`
- `<registry-host>/ctms/ctms-backend:rc-<short_sha>`
- `<registry-host>/ctms/ctms-nginx:rc-<release-branch>`
- `<registry-host>/ctms/ctms-nginx:rc-<short_sha>`
- `<registry-host>/ctms/ctms-frontend:rc-<release-branch>`
- `<registry-host>/ctms/ctms-frontend:rc-<short_sha>`
- `main` branch pushes publish:
- `<registry-host>/ctms/ctms-backend:latest`
- `<registry-host>/ctms/ctms-backend:sha-<short_sha>`
- `<registry-host>/ctms/ctms-nginx:latest`
- `<registry-host>/ctms/ctms-nginx:sha-<short_sha>`
- `<registry-host>/ctms/ctms-frontend:latest`
- `<registry-host>/ctms/ctms-frontend:sha-<short_sha>`
**Server Requirements**
- Docker installed on the Tencent Cloud server.
@@ -64,7 +63,7 @@
- `REGISTRY_PASSWORD`
**Compose Integration**
- `docker-compose.yaml` should define `image:` for `backend`, `backend-init`, and `nginx`, with defaults based on private registry variables such as `REGISTRY_HOST`.
- `docker-compose.yaml` should define `image:` for `backend`, `backend-init`, and `frontend`, with defaults based on private registry variables such as `REGISTRY_HOST`.
- Existing `build:` blocks stay in place so local `docker compose up -d --build` continues to work.
- Deployment hosts can export `REGISTRY_HOST`, then run `docker login`, `docker compose pull`, `docker compose run --rm backend-init`, and `docker compose up -d`.