From e34592c3d4eaac4d11475de892e5c686a3436b9e Mon Sep 17 00:00:00 2001 From: ageerle Date: Tue, 4 Aug 2026 15:18:57 +0800 Subject: [PATCH] release: prepare v3.1.0 --- .github/workflows/publish-images.yml | 107 +++++++++++++++++++ .gitignore | 3 + README.md | 32 +++--- README_ZH.md | 32 +++--- docs/docker/ruoyi-ai/.env.example | 6 ++ docs/docker/ruoyi-ai/docker-compose-all.yaml | 18 ++-- 6 files changed, 157 insertions(+), 41 deletions(-) create mode 100644 .github/workflows/publish-images.yml create mode 100644 docs/docker/ruoyi-ai/.env.example diff --git a/.github/workflows/publish-images.yml b/.github/workflows/publish-images.yml new file mode 100644 index 00000000..02074d9c --- /dev/null +++ b/.github/workflows/publish-images.yml @@ -0,0 +1,107 @@ +name: Publish Docker Images + +on: + push: + tags: + - 'v*.*.*' + +concurrency: + group: publish-images-${{ github.ref_name }} + cancel-in-progress: false + +env: + REGISTRY: ghcr.io + IMAGE_OWNER: ${{ github.repository_owner }} + RELEASE_TAG: ${{ github.ref_name }} + +jobs: + publish: + name: Publish ${{ matrix.image }} + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + attestations: write + id-token: write + + strategy: + fail-fast: false + matrix: + include: + - image: ruoyi-ai-backend + source: local + context: . + dockerfile: docs/docker/ruoyi-ai/Dockerfile.backend + - image: ruoyi-ai-mysql + source: local + context: . + dockerfile: docs/docker/ruoyi-ai/Dockerfile.mysql + - image: ruoyi-ai-admin + source: admin + context: build/ruoyi-admin + dockerfile: build/ruoyi-admin/apps/web-antd/Dockerfile + - image: ruoyi-ai-web + source: web + context: build/ruoyi-web + dockerfile: build/ruoyi-web/Dockerfile.frontend + + steps: + - name: Checkout backend repository + uses: actions/checkout@v6 + with: + ref: ${{ env.RELEASE_TAG }} + fetch-depth: 1 + + - name: Checkout admin repository + if: matrix.source == 'admin' + uses: actions/checkout@v6 + with: + repository: ${{ github.repository_owner }}/ruoyi-admin + ref: ${{ env.RELEASE_TAG }} + path: build/ruoyi-admin + fetch-depth: 1 + + - name: Checkout web repository + if: matrix.source == 'web' + uses: actions/checkout@v6 + with: + repository: ${{ github.repository_owner }}/ruoyi-web + ref: ${{ env.RELEASE_TAG }} + path: build/ruoyi-web + fetch-depth: 1 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Log in to GHCR + uses: docker/login-action@v3 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract Docker metadata + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_OWNER }}/${{ matrix.image }} + tags: | + type=raw,value=${{ env.RELEASE_TAG }} + type=raw,value=latest + labels: | + org.opencontainers.image.source=https://github.com/${{ github.repository }} + org.opencontainers.image.version=${{ env.RELEASE_TAG }} + + - name: Build and push image + uses: docker/build-push-action@v6 + with: + context: ${{ matrix.context }} + file: ${{ matrix.dockerfile }} + platforms: linux/amd64 + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + cache-from: type=gha,scope=${{ matrix.image }} + cache-to: type=gha,mode=max,scope=${{ matrix.image }} + provenance: true + sbom: true diff --git a/.gitignore b/.gitignore index d86054dd..5989fdc8 100644 --- a/.gitignore +++ b/.gitignore @@ -23,6 +23,9 @@ target/ .idea .claude .github +!.github/ +!.github/workflows/ +!.github/workflows/** *.iws *.iml *.ipr diff --git a/README.md b/README.md index 935de6d2..ba6266b1 100644 --- a/README.md +++ b/README.md @@ -75,11 +75,11 @@ Use `docker-compose-all.yaml` to start all services at once (including backend, git clone https://github.com/ageerle/ruoyi-ai.git cd ruoyi-ai -# Start all services (pull pre-built images from registry) -docker-compose -f docker-compose-all.yaml up -d +# Start all services (pull pre-built images from GHCR) +docker compose -f docs/docker/ruoyi-ai/docker-compose-all.yaml up -d # Check service status -docker-compose -f docker-compose-all.yaml ps +docker compose -f docs/docker/ruoyi-ai/docker-compose-all.yaml ps # Access services # Admin Panel: http://localhost:25666 (admin / admin123) @@ -145,32 +145,32 @@ docker-compose up -d --build ### Image Registry -All images are hosted on Alibaba Cloud Container Registry: +Application images are published to GitHub Container Registry (GHCR) by GitHub Actions when a release tag such as `v3.1.0` is pushed: ``` -crpi-31mraxd99y2gqdgr.cn-beijing.personal.cr.aliyuncs.com/ruoyi_ai +ghcr.io/ageerle/ruoyi-ai-backend:v3.1.0 +ghcr.io/ageerle/ruoyi-ai-mysql:v3.1.0 +ghcr.io/ageerle/ruoyi-ai-admin:v3.1.0 +ghcr.io/ageerle/ruoyi-ai-web:v3.1.0 ``` -Available images: -- `mysql:v3` - MySQL database (includes initialization SQL) -- `redis:6.2` - Redis cache -- `weaviate:1.30.0` - Vector database -- `minio:latest` - Object storage -- `ruoyi-ai-backend:latest` - Backend service -- `ruoyi-ai-admin:latest` - Admin frontend -- `ruoyi-ai-web:latest` - User frontend +The Compose file defaults to `latest`. To pin a release, create `docs/docker/ruoyi-ai/.env` with `RUIYI_VERSION=v3.1.0`. + +After the first workflow run, set the four GHCR packages to `Public` in GitHub so deployment servers can pull them without logging in. + +The same release tag must exist in `ageerle/ruoyi-admin` and `ageerle/ruoyi-web`; the publish workflow checks out those repositories at the backend release tag before building their images. ### Common Commands ```bash # Stop all services -docker-compose -f docker-compose-all.yaml down +docker compose -f docs/docker/ruoyi-ai/docker-compose-all.yaml down # View service logs -docker-compose -f docker-compose-all.yaml logs -f [service-name] +docker compose -f docs/docker/ruoyi-ai/docker-compose-all.yaml logs -f [service-name] # Restart a service -docker-compose -f docker-compose-all.yaml restart [service-name] +docker compose -f docs/docker/ruoyi-ai/docker-compose-all.yaml restart [service-name] ``` ## 📚 Documentation diff --git a/README_ZH.md b/README_ZH.md index 08195748..d7baa09f 100644 --- a/README_ZH.md +++ b/README_ZH.md @@ -74,11 +74,11 @@ git clone https://github.com/ageerle/ruoyi-ai.git cd ruoyi-ai -# 启动所有服务(从镜像仓库拉取预构建镜像) -docker-compose -f docker-compose-all.yaml up -d +# 启动所有服务(从 GHCR 拉取预构建镜像) +docker compose -f docs/docker/ruoyi-ai/docker-compose-all.yaml up -d # 查看服务状态 -docker-compose -f docker-compose-all.yaml ps +docker compose -f docs/docker/ruoyi-ai/docker-compose-all.yaml ps # 访问服务 # 管理端: http://localhost:25666 (admin / admin123) @@ -144,32 +144,32 @@ docker-compose up -d --build ### 镜像仓库 -所有镜像托管在阿里云容器镜像服务: +每次推送类似 `v3.1.0` 的版本标签后,GitHub Actions 会自动构建并发布应用镜像到 GitHub Container Registry(GHCR): ``` -crpi-31mraxd99y2gqdgr.cn-beijing.personal.cr.aliyuncs.com/ruoyi_ai +ghcr.io/ageerle/ruoyi-ai-backend:v3.1.0 +ghcr.io/ageerle/ruoyi-ai-mysql:v3.1.0 +ghcr.io/ageerle/ruoyi-ai-admin:v3.1.0 +ghcr.io/ageerle/ruoyi-ai-web:v3.1.0 ``` -可用镜像: -- `mysql:v3` - MySQL 数据库(包含初始化 SQL) -- `redis:6.2` - Redis 缓存 -- `weaviate:1.30.0` - 向量数据库 -- `minio:latest` - 对象存储 -- `ruoyi-ai-backend:latest` - 后端服务 -- `ruoyi-ai-admin:latest` - 管理端前端 -- `ruoyi-ai-web:latest` - 用户端前端 +Compose 默认使用 `latest`。如需固定版本,可在 `docs/docker/ruoyi-ai/.env` 中设置 `RUIYI_VERSION=v3.1.0`。 + +首次工作流运行完成后,请在 GitHub 的 Packages 设置中将这四个 GHCR 镜像设为 `Public`,用户服务器才能免登录拉取。 + +管理端 `ageerle/ruoyi-admin` 和用户端 `ageerle/ruoyi-web` 也必须存在同名版本标签;发布工作流会使用后端发布标签检出这两个仓库后再构建镜像。 ### 常用命令 ```bash # 停止所有服务 -docker-compose -f docker-compose-all.yaml down +docker compose -f docs/docker/ruoyi-ai/docker-compose-all.yaml down # 查看服务日志 -docker-compose -f docker-compose-all.yaml logs -f [服务名] +docker compose -f docs/docker/ruoyi-ai/docker-compose-all.yaml logs -f [服务名] # 重启某个服务 -docker-compose -f docker-compose-all.yaml restart [服务名] +docker compose -f docs/docker/ruoyi-ai/docker-compose-all.yaml restart [服务名] ``` ## 📚 使用文档 diff --git a/docs/docker/ruoyi-ai/.env.example b/docs/docker/ruoyi-ai/.env.example new file mode 100644 index 00000000..601a3a0c --- /dev/null +++ b/docs/docker/ruoyi-ai/.env.example @@ -0,0 +1,6 @@ +# GitHub Container Registry namespace owner. +# For the upstream project this is ageerle; change it when using a fork. +IMAGE_OWNER=ageerle + +# Use latest for convenience, or pin a release such as v3.1.0. +RUIYI_VERSION=latest diff --git a/docs/docker/ruoyi-ai/docker-compose-all.yaml b/docs/docker/ruoyi-ai/docker-compose-all.yaml index 21c781a5..f690ca24 100644 --- a/docs/docker/ruoyi-ai/docker-compose-all.yaml +++ b/docs/docker/ruoyi-ai/docker-compose-all.yaml @@ -10,13 +10,13 @@ # - RuoYi-Admin (管理端前端) # - RuoYi-Web (用户端前端) # -# 镜像仓库地址: crpi-31mraxd99y2gqdgr.cn-beijing.personal.cr.aliyuncs.com/ruoyi_ai +# 镜像仓库地址: ghcr.io/ageerle services: # ==================== MySQL 数据库 ==================== mysql: - # 阿里云镜像地址(包含初始化SQL) - image: crpi-31mraxd99y2gqdgr.cn-beijing.personal.cr.aliyuncs.com/ruoyi_ai/mysql:v3 + # GHCR 镜像(包含初始化SQL) + image: ghcr.io/${IMAGE_OWNER:-ageerle}/ruoyi-ai-mysql:${RUIYI_VERSION:-latest} container_name: ruoyi-ai-mysql restart: always ports: @@ -41,7 +41,7 @@ services: # ==================== Redis 缓存 ==================== redis: - image: crpi-31mraxd99y2gqdgr.cn-beijing.personal.cr.aliyuncs.com/ruoyi_ai/redis:6.2 + image: redis:6.2 container_name: ruoyi-ai-redis restart: always ports: @@ -59,7 +59,7 @@ services: # ==================== Weaviate 向量数据库 ==================== weaviate: - image: crpi-31mraxd99y2gqdgr.cn-beijing.personal.cr.aliyuncs.com/ruoyi_ai/weaviate:1.30.0 + image: semitechnologies/weaviate:1.30.0 container_name: ruoyi-ai-weaviate restart: always ports: @@ -78,7 +78,7 @@ services: # ==================== MinIO 对象存储 ==================== minio: - image: crpi-31mraxd99y2gqdgr.cn-beijing.personal.cr.aliyuncs.com/ruoyi_ai/minio:latest + image: minio/minio:latest container_name: ruoyi-ai-minio restart: always ports: @@ -95,7 +95,7 @@ services: # ==================== RuoYi-AI 后端服务 ==================== backend: - image: crpi-31mraxd99y2gqdgr.cn-beijing.personal.cr.aliyuncs.com/ruoyi_ai/ruoyi-ai-backend:latest + image: ghcr.io/${IMAGE_OWNER:-ageerle}/ruoyi-ai-backend:${RUIYI_VERSION:-latest} container_name: ruoyi-ai-backend restart: always ports: @@ -129,7 +129,7 @@ services: # ==================== RuoYi-AI 管理端前端 ==================== admin-frontend: - image: crpi-31mraxd99y2gqdgr.cn-beijing.personal.cr.aliyuncs.com/ruoyi_ai/ruoyi-ai-admin:latest + image: ghcr.io/${IMAGE_OWNER:-ageerle}/ruoyi-ai-admin:${RUIYI_VERSION:-latest} container_name: ruoyi-ai-admin restart: always ports: @@ -154,7 +154,7 @@ services: # ==================== RuoYi-AI 用户端前端 ==================== web-frontend: - image: crpi-31mraxd99y2gqdgr.cn-beijing.personal.cr.aliyuncs.com/ruoyi_ai/ruoyi-ai-web:latest + image: ghcr.io/${IMAGE_OWNER:-ageerle}/ruoyi-ai-web:${RUIYI_VERSION:-latest} container_name: ruoyi-ai-web restart: always ports: