From 778c609c7b5ca30eaa0b4f6ebec43fa01d5f032a Mon Sep 17 00:00:00 2001 From: filenew1 <819567884@qq.com> Date: Fri, 5 Sep 2025 16:35:51 +0800 Subject: [PATCH 01/14] Delete .github/workflows/docs-deploy.yml --- .github/workflows/docs-deploy.yml | 163 ------------------------------ 1 file changed, 163 deletions(-) delete mode 100644 .github/workflows/docs-deploy.yml diff --git a/.github/workflows/docs-deploy.yml b/.github/workflows/docs-deploy.yml deleted file mode 100644 index 47307b491213..000000000000 --- a/.github/workflows/docs-deploy.yml +++ /dev/null @@ -1,163 +0,0 @@ -name: Document deploy -on: - push: - branches: - - main - paths: - - 'document/**' - workflow_dispatch: - -permissions: - contents: read - packages: write - attestations: write - id-token: write - pull-requests: write - -jobs: - sync-images: - runs-on: ubuntu-latest - steps: - - name: Checkout current repository - uses: actions/checkout@v4 - - - name: Checkout target repository - uses: actions/checkout@v4 - with: - repository: labring/fastgpt-img - token: ${{ secrets.DOCS_IMGS_SYNC_TOKEN }} - path: fastgpt-img - - - name: Sync images - run: | - # Create imgs directory if it doesn't exist - mkdir -p fastgpt-img - - # Copy all images from document/public/imgs to the target repository - cp -r document/public/imgs/* fastgpt-img - - # Navigate to target repository - cd fastgpt-img - - # Configure git - git config user.name "github-actions[bot]" - git config user.email "github-actions[bot]@users.noreply.github.com" - - # Add, commit and push changes - git add . - if ! git diff --cached --quiet; then - git commit -m "Sync images from FastGPT document at $(date)" - git push - echo "Images synced successfully" - else - echo "No changes to sync" - fi - # Add a new job to generate unified timestamp - generate-timestamp: - needs: sync-images - runs-on: ubuntu-latest - outputs: - datetime: ${{ steps.datetime.outputs.datetime }} - steps: - - name: Get current datetime - id: datetime - run: echo "datetime=$(date +'%Y%m%d%H%M%S')" >> $GITHUB_OUTPUT - - build-images: - needs: generate-timestamp - runs-on: ubuntu-latest - strategy: - matrix: - domain_config: - - domain: 'https://fastgpt.io' - suffix: 'io' - - domain: 'https://fastgpt.cn' - suffix: 'cn' - - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Rewrite image paths - if: matrix.domain_config.suffix == 'io' - run: | - find document/content/docs -name "*.mdx" -type f | while read file; do - sed -i 's|](/imgs/|](https://cdn.jsdelivr.net/gh/labring/fastgpt-img@main/|g' "$file" - done - - - name: Docker meta - id: meta - uses: docker/metadata-action@v5 - with: - # list of Docker images to use as base name for tags - images: | - ${{ secrets.ALI_IMAGE_NAME }}/fastgpt-docs - tags: | - ${{ matrix.domain_config.suffix }}-${{ needs.generate-timestamp.outputs.datetime }} - flavor: latest=false - - - name: Login to Aliyun - uses: docker/login-action@v3 - with: - registry: registry.cn-hangzhou.aliyuncs.com - username: ${{ secrets.ALI_HUB_USERNAME }} - password: ${{ secrets.ALI_HUB_PASSWORD }} - - - name: Build and push Docker images (CN) - if: matrix.domain_config.suffix == 'cn' - uses: docker/build-push-action@v5 - with: - context: ./document - file: ./document/Dockerfile - push: true - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} - platforms: linux/amd64 - build-args: | - FASTGPT_HOME_DOMAIN=${{ matrix.domain_config.domain }} - - - name: Build and push Docker images (IO) - if: matrix.domain_config.suffix == 'io' - uses: docker/build-push-action@v5 - with: - context: ./document - file: ./document/Dockerfile - push: true - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} - platforms: linux/amd64 - build-args: | - FASTGPT_HOME_DOMAIN=${{ matrix.domain_config.domain }} - - update-images: - needs: [generate-timestamp, build-images] - runs-on: ubuntu-24.04 - strategy: - matrix: - domain_config: - - domain: 'https://fastgpt.io' - suffix: 'io' - deployment: 'fastgpt-docs' - kube_config: 'KUBE_CONFIG_IO' - - domain: 'https://fastgpt.cn' - suffix: 'cn' - deployment: 'fastgpt-docs' - kube_config: 'KUBE_CONFIG_CN' - steps: - - name: Checkout code - uses: actions/checkout@v4 - - # Add kubeconfig setup step to handle encoding issues - - name: Setup kubeconfig - run: | - mkdir -p $HOME/.kube - echo "${{ secrets[matrix.domain_config.kube_config] }}" > $HOME/.kube/config - chmod 600 $HOME/.kube/config - - - name: Update deployment image - run: | - kubectl set image deployment/${{ matrix.domain_config.deployment }} ${{ matrix.domain_config.deployment }}=${{ secrets.ALI_IMAGE_NAME }}/fastgpt-docs:${{ matrix.domain_config.suffix }}-${{ needs.generate-timestamp.outputs.datetime }} - - - name: Annotate deployment - run: | - kubectl annotate deployment/${{ matrix.domain_config.deployment }} originImageName="${{ secrets.ALI_IMAGE_NAME }}/fastgpt-docs:${{ matrix.domain_config.suffix }}-${{ needs.generate-timestamp.outputs.datetime }}" --overwrite From 313659bae3fb3d8d15298c0f2c93d380d682d1f2 Mon Sep 17 00:00:00 2001 From: filenew1 <819567884@qq.com> Date: Fri, 5 Sep 2025 16:36:00 +0800 Subject: [PATCH 02/14] Delete .github/workflows/docs-preview.yml --- .github/workflows/docs-preview.yml | 96 ------------------------------ 1 file changed, 96 deletions(-) delete mode 100644 .github/workflows/docs-preview.yml diff --git a/.github/workflows/docs-preview.yml b/.github/workflows/docs-preview.yml deleted file mode 100644 index 367b9f7fac9f..000000000000 --- a/.github/workflows/docs-preview.yml +++ /dev/null @@ -1,96 +0,0 @@ -name: Preview documents -on: - pull_request_target: - paths: - - 'document/**' - workflow_dispatch: - -permissions: - contents: read - packages: write - attestations: write - id-token: write - pull-requests: write - -jobs: - build-images: - runs-on: ubuntu-latest - - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - ref: ${{ github.event.pull_request.head.sha }} - - - name: Get current datetime - id: datetime - run: echo "datetime=$(date +'%Y%m%d%H%M%S')" >> $GITHUB_OUTPUT - - - name: Docker meta - id: meta - uses: docker/metadata-action@v5 - with: - # list of Docker images to use as base name for tags - images: | - ${{ secrets.ALI_IMAGE_NAME }}/fastgpt-docs - tags: | - ${{ steps.datetime.outputs.datetime }} - flavor: latest=false - - - name: Login to Aliyun - uses: docker/login-action@v3 - with: - registry: registry.cn-hangzhou.aliyuncs.com - username: ${{ secrets.ALI_HUB_USERNAME }} - password: ${{ secrets.ALI_HUB_PASSWORD }} - - - name: Build and push Docker images - uses: docker/build-push-action@v5 - with: - context: ./document - file: ./document/Dockerfile - push: true - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} - build-args: | - FASTGPT_HOME_DOMAIN=https://fastgpt.io - outputs: - tags: ${{ steps.datetime.outputs.datetime }} - - update-images: - needs: build-images - runs-on: ubuntu-24.04 - steps: - - name: Checkout code - uses: actions/checkout@v4 - with: - ref: ${{ github.event.pull_request.head.sha }} - - # Add kubeconfig setup step to handle encoding issues - - name: Setup kubeconfig - run: | - mkdir -p $HOME/.kube - echo "${{ secrets.KUBE_CONFIG_CN }}" > $HOME/.kube/config - chmod 600 $HOME/.kube/config - - - name: Update deployment image - run: | - kubectl set image deployment/fastgpt-docs-preview fastgpt-docs-preview=${{ secrets.ALI_IMAGE_NAME }}/fastgpt-docs:${{ needs.build-images.outputs.tags }} - - - name: Annotate deployment - run: | - kubectl annotate deployment/fastgpt-docs-preview originImageName="${{ secrets.ALI_IMAGE_NAME }}/fastgpt-docs:${{ needs.build-images.outputs.tags }}" --overwrite - - - name: '@finleyge/github-tools' - uses: FinleyGe/github-tools@0.0.1 - id: print-image-label - if: success() - with: - token: ${{ secrets.GITHUB_TOKEN }} - tool: issue-comment - title: 'Docs Preview:' - body: | - --- - 🚀 **FastGPT Document Preview Ready!** - - 🔗 [👀 Click here to visit preview](https://pueuoharpgcl.sealoshzh.site) From 1c101a7f78ac005b9f6a9ba913f5c88aa865aed7 Mon Sep 17 00:00:00 2001 From: filenew1 <819567884@qq.com> Date: Fri, 5 Sep 2025 18:51:31 +0800 Subject: [PATCH 03/14] Delete .github/workflows/fastgpt-build-image-personal.yml --- .../fastgpt-build-image-personal.yml | 129 ------------------ 1 file changed, 129 deletions(-) delete mode 100644 .github/workflows/fastgpt-build-image-personal.yml diff --git a/.github/workflows/fastgpt-build-image-personal.yml b/.github/workflows/fastgpt-build-image-personal.yml deleted file mode 100644 index b181bf06fe81..000000000000 --- a/.github/workflows/fastgpt-build-image-personal.yml +++ /dev/null @@ -1,129 +0,0 @@ -name: Build FastGPT images in Personal warehouse -on: - workflow_dispatch: - push: - paths: - - 'projects/app/**' - - 'packages/**' - branches: - - 'main' - -jobs: - get-vars: - runs-on: ubuntu-24.04 - outputs: - docker_repo: ${{ steps.set_docker_repo.outputs.docker_repo }} - docker_tag: ${{ steps.set_docker_repo.outputs.docker_tag }} - steps: - - name: Set docker repository and tag - id: set_docker_repo - run: | - echo "docker_repo=ghcr.io/$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_OUTPUT - if [[ "${{ github.ref_name }}" == "main" ]]; then - echo "docker_tag=latest" >> $GITHUB_OUTPUT - else - echo "docker_tag=${{ github.ref_name }}" >> $GITHUB_OUTPUT - fi - - build-fastgpt-images: - needs: get-vars - permissions: - packages: write - contents: read - attestations: write - id-token: write - strategy: - matrix: - archs: - - arch: amd64 - runs-on: ubuntu-24.04 - - arch: arm64 - runs-on: ubuntu-24.04-arm - runs-on: ${{ matrix.archs.runs-on || 'ubuntu-24.04' }} - if: github.repository != 'labring/FastGPT' - steps: - - name: Checkout - uses: actions/checkout@v3 - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - with: - driver-opts: network=host - - name: Cache Docker layers - uses: actions/cache@v3 - with: - path: /tmp/.buildx-cache - key: ${{ runner.os }}-${{ matrix.archs.arch }}-buildx-${{ github.sha }} - restore-keys: | - ${{ runner.os }}-${{ matrix.archs.arch }}-buildx- - - name: Login to GitHub Container Registry - uses: docker/login-action@v2 - with: - registry: ghcr.io - username: ${{ github.repository_owner }} - password: ${{ secrets.GITHUB_TOKEN }} - - name: Build and push for ${{ matrix.archs.arch }} - id: build - uses: docker/build-push-action@v6 - with: - context: . - file: projects/app/Dockerfile - platforms: linux/${{ matrix.archs.arch }} - labels: | - org.opencontainers.image.source=https://github.com/${{ github.repository }} - org.opencontainers.image.description=fastgpt image - outputs: type=image,"name=${{ needs.get-vars.outputs.docker_repo }}",push-by-digest=true,push=true - cache-from: type=local,src=/tmp/.buildx-cache - cache-to: type=local,dest=/tmp/.buildx-cache - - name: Export digest - run: | - mkdir -p ${{ runner.temp }}/digests - digest="${{ steps.build.outputs.digest }}" - touch "${{ runner.temp }}/digests/${digest#sha256:}" - - - name: Upload digest - uses: actions/upload-artifact@v4 - with: - name: digests-${{ github.sha }}-${{ matrix.archs.arch }} - path: ${{ runner.temp }}/digests/* - if-no-files-found: error - retention-days: 1 - - release-fastgpt-images: - permissions: - packages: write - contents: read - attestations: write - id-token: write - needs: [get-vars, build-fastgpt-images] - runs-on: ubuntu-24.04 - steps: - - name: Login to GitHub Container Registry - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.repository_owner }} - password: ${{ secrets.GITHUB_TOKEN }} - - name: Download digests - uses: actions/download-artifact@v4 - with: - path: ${{ runner.temp }}/digests - pattern: digests-${{ github.sha }}-* - merge-multiple: true - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - - name: Set image name and tag - run: | - echo "Git_Tag=${{ needs.get-vars.outputs.docker_repo }}:${{ needs.get-vars.outputs.docker_tag }}" >> $GITHUB_ENV - echo "Git_Latest=${{ needs.get-vars.outputs.docker_repo }}:latest" >> $GITHUB_ENV - - - name: Create manifest list and push - working-directory: ${{ runner.temp }}/digests - run: | - TAGS="$(echo -e "${Git_Tag}\n${Git_Latest}")" - for TAG in $TAGS; do - docker buildx imagetools create -t $TAG \ - $(printf '${{ needs.get-vars.outputs.docker_repo }}@sha256:%s ' *) - sleep 5 - done From cb4c94f4566203e1d29294b0b72e2792f85d703f Mon Sep 17 00:00:00 2001 From: filenew1 <819567884@qq.com> Date: Fri, 5 Sep 2025 18:51:48 +0800 Subject: [PATCH 04/14] Delete .github/workflows/fastgpt-preview-image.yml --- .github/workflows/fastgpt-preview-image.yml | 91 --------------------- 1 file changed, 91 deletions(-) delete mode 100644 .github/workflows/fastgpt-preview-image.yml diff --git a/.github/workflows/fastgpt-preview-image.yml b/.github/workflows/fastgpt-preview-image.yml deleted file mode 100644 index b17d7570663c..000000000000 --- a/.github/workflows/fastgpt-preview-image.yml +++ /dev/null @@ -1,91 +0,0 @@ -name: Preview FastGPT images -on: - pull_request_target: - workflow_dispatch: - -jobs: - preview-fastgpt-images: - permissions: - contents: read - packages: write - attestations: write - id-token: write - pull-requests: write - - runs-on: ubuntu-24.04 - strategy: - matrix: - image: [fastgpt, sandbox, mcp_server] - fail-fast: false # 即使一个镜像构建失败,也继续构建其他镜像 - - steps: - - name: Checkout - uses: actions/checkout@v3 - with: - ref: ${{ github.event.pull_request.head.ref }} - repository: ${{ github.event.pull_request.head.repo.full_name }} - fetch-depth: 0 - token: ${{ secrets.GITHUB_TOKEN }} - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 - with: - driver-opts: network=host - - - name: Cache Docker layers - uses: actions/cache@v3 - with: - path: /tmp/.buildx-cache - key: ${{ runner.os }}-buildx-${{ github.sha }}-${{ matrix.image }} - restore-keys: | - ${{ runner.os }}-buildx-${{ github.sha }}- - ${{ runner.os }}-buildx- - - - name: Login to Aliyun Container Registry - uses: docker/login-action@v3 - with: - registry: registry.cn-hangzhou.aliyuncs.com - username: ${{ secrets.ALI_HUB_USERNAME }} - password: ${{ secrets.ALI_HUB_PASSWORD }} - - - name: Set image config - id: config - run: | - if [[ "${{ matrix.image }}" == "fastgpt" ]]; then - echo "DOCKERFILE=projects/app/Dockerfile" >> $GITHUB_OUTPUT - echo "DESCRIPTION=fastgpt-pr image" >> $GITHUB_OUTPUT - echo "DOCKER_REPO_TAGGED=${{ secrets.ALI_IMAGE_NAME }}/fastgpt-pr:fatsgpt_${{ github.event.pull_request.head.sha }}" >> $GITHUB_OUTPUT - elif [[ "${{ matrix.image }}" == "sandbox" ]]; then - echo "DOCKERFILE=projects/sandbox/Dockerfile" >> $GITHUB_OUTPUT - echo "DESCRIPTION=fastgpt-sandbox-pr image" >> $GITHUB_OUTPUT - echo "DOCKER_REPO_TAGGED=${{ secrets.ALI_IMAGE_NAME }}/fastgpt-pr:fatsgpt_sandbox_${{ github.event.pull_request.head.sha }}" >> $GITHUB_OUTPUT - elif [[ "${{ matrix.image }}" == "mcp_server" ]]; then - echo "DOCKERFILE=projects/mcp_server/Dockerfile" >> $GITHUB_OUTPUT - echo "DESCRIPTION=fastgpt-mcp_server-pr image" >> $GITHUB_OUTPUT - echo "DOCKER_REPO_TAGGED=${{ secrets.ALI_IMAGE_NAME }}/fastgpt-pr:fatsgpt_mcp_server_${{ github.event.pull_request.head.sha }}" >> $GITHUB_OUTPUT - fi - - - name: Build ${{ matrix.image }} image for PR - run: | - docker buildx build \ - -f ${{ steps.config.outputs.DOCKERFILE }} \ - --label "org.opencontainers.image.source=https://github.com/${{ github.repository_owner }}/FastGPT" \ - --label "org.opencontainers.image.description=${{ steps.config.outputs.DESCRIPTION }}" \ - --push \ - --cache-from=type=local,src=/tmp/.buildx-cache \ - --cache-to=type=local,dest=/tmp/.buildx-cache \ - -t ${{ steps.config.outputs.DOCKER_REPO_TAGGED }} \ - . - - - name: '@finleyge/github-tools' - uses: FinleyGe/github-tools@0.0.1 - id: print-image-label - if: success() - with: - token: ${{ secrets.GITHUB_TOKEN }} - tool: issue-comment - title: 'Preview ${{ matrix.image }} Image:' - body: | - ``` - ${{ steps.config.outputs.DOCKER_REPO_TAGGED }} - ``` From aaeeaece40172b50675a411acb2741010d6b340d Mon Sep 17 00:00:00 2001 From: filenew1 <819567884@qq.com> Date: Fri, 5 Sep 2025 18:52:01 +0800 Subject: [PATCH 05/14] Delete .github/workflows/fastgpt-test.yaml --- .github/workflows/fastgpt-test.yaml | 32 ----------------------------- 1 file changed, 32 deletions(-) delete mode 100644 .github/workflows/fastgpt-test.yaml diff --git a/.github/workflows/fastgpt-test.yaml b/.github/workflows/fastgpt-test.yaml deleted file mode 100644 index 6d41fbb9dc6a..000000000000 --- a/.github/workflows/fastgpt-test.yaml +++ /dev/null @@ -1,32 +0,0 @@ -name: 'FastGPT-Test' -on: - pull_request: - workflow_dispatch: - -jobs: - test: - runs-on: ubuntu-latest - - permissions: - # Required to checkout the code - contents: read - # Required to put a comment into the pull-request - pull-requests: write - - steps: - - uses: actions/checkout@v4 - with: - ref: ${{ github.event.pull_request.head.ref }} - repository: ${{ github.event.pull_request.head.repo.full_name }} - - uses: pnpm/action-setup@v4 - with: - version: 10 - - name: 'Install Deps' - run: pnpm install - - name: 'Test' - run: pnpm run test - - name: 'Report Coverage' - # Set if: always() to also generate the report if tests are failing - # Only works if you set `reportOnFailure: true` in your vite config as specified above - if: always() - uses: davelosert/vitest-coverage-report-action@v2 From f4621aae2a5654d5bd214c8825439836505e2863 Mon Sep 17 00:00:00 2001 From: filenew1 <819567884@qq.com> Date: Fri, 5 Sep 2025 18:52:16 +0800 Subject: [PATCH 06/14] Delete .github/workflows/helm-release.yaml --- .github/workflows/helm-release.yaml | 34 ----------------------------- 1 file changed, 34 deletions(-) delete mode 100644 .github/workflows/helm-release.yaml diff --git a/.github/workflows/helm-release.yaml b/.github/workflows/helm-release.yaml deleted file mode 100644 index 9c516992e4bb..000000000000 --- a/.github/workflows/helm-release.yaml +++ /dev/null @@ -1,34 +0,0 @@ -name: Release helm chart - -on: - push: - tags: - - 'v*.*.*' - workflow_dispatch: - -jobs: - helm: - permissions: - packages: write - contents: read - attestations: write - id-token: write - runs-on: ubuntu-24.04 - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - fetch-tags: true - fetch-depth: 0 - - name: Set output - id: vars - run: echo "tag=$(git describe --tags)" >> $GITHUB_OUTPUT - - name: Release Helm - run: | - echo ${{ secrets.GITHUB_TOKEN }} | helm registry login ghcr.io -u ${{ github.repository_owner }} --password-stdin - export APP_VERSION=${{ steps.vars.outputs.tag }} - export HELM_VERSION=${{ steps.vars.outputs.tag }} - export HELM_REPO=ghcr.io/${{ github.repository_owner }} - helm dependency update deploy/helm/fastgpt - helm package deploy/helm/fastgpt --version ${HELM_VERSION}-helm --app-version ${APP_VERSION} -d bin - helm push bin/fastgpt-${HELM_VERSION}-helm.tgz oci://${HELM_REPO} From e4e5a4474fe477cf8d9988efb819be805ba9116d Mon Sep 17 00:00:00 2001 From: filenew1 <819567884@qq.com> Date: Fri, 5 Sep 2025 18:52:26 +0800 Subject: [PATCH 07/14] Delete .github/workflows/mcp_server-build-image.yml --- .github/workflows/mcp_server-build-image.yml | 151 ------------------- 1 file changed, 151 deletions(-) delete mode 100644 .github/workflows/mcp_server-build-image.yml diff --git a/.github/workflows/mcp_server-build-image.yml b/.github/workflows/mcp_server-build-image.yml deleted file mode 100644 index 83b79531c959..000000000000 --- a/.github/workflows/mcp_server-build-image.yml +++ /dev/null @@ -1,151 +0,0 @@ -name: Build fastgpt-mcp-server images -on: - workflow_dispatch: - push: - paths: - - 'projects/mcp_server/**' - tags: - - 'v*' -jobs: - build-fastgpt-mcp_server-images: - permissions: - packages: write - contents: read - attestations: write - id-token: write - strategy: - matrix: - include: - - arch: amd64 - - arch: arm64 - runs-on: ubuntu-24.04-arm - runs-on: ${{ matrix.runs-on || 'ubuntu-24.04' }} - steps: - # install env - - name: Checkout - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - with: - driver-opts: network=host - - name: Cache Docker layers - uses: actions/cache@v4 - with: - path: /tmp/.buildx-cache - key: ${{ runner.os }}-mcp-server-buildx-${{ github.sha }} - restore-keys: | - ${{ runner.os }}-mcp_server-buildx- - - # login docker - - name: Login to GitHub Container Registry - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.repository_owner }} - password: ${{ secrets.GITHUB_TOKEN }} - - name: Login to Ali Hub - uses: docker/login-action@v3 - with: - registry: registry.cn-hangzhou.aliyuncs.com - username: ${{ secrets.ALI_HUB_USERNAME }} - password: ${{ secrets.ALI_HUB_PASSWORD }} - - name: Login to Docker Hub - uses: docker/login-action@v3 - with: - username: ${{ secrets.DOCKER_HUB_NAME }} - password: ${{ secrets.DOCKER_HUB_PASSWORD }} - - - name: Build for ${{ matrix.arch }} - id: build - uses: docker/build-push-action@v6 - with: - context: . - file: projects/mcp_server/Dockerfile - platforms: linux/${{ matrix.arch }} - labels: | - org.opencontainers.image.source=https://github.com/${{ github.repository }} - org.opencontainers.image.description=fastgpt-mcp_server image - outputs: type=image,"name=ghcr.io/${{ github.repository_owner }}/fastgpt-mcp_server,${{ secrets.ALI_IMAGE_NAME }}/fastgpt-mcp_server,${{ secrets.DOCKER_IMAGE_NAME }}/fastgpt-mcp_server",push-by-digest=true,push=true - cache-from: type=local,src=/tmp/.buildx-cache - cache-to: type=local,dest=/tmp/.buildx-cache - - - name: Export digest - run: | - mkdir -p ${{ runner.temp }}/digests - digest="${{ steps.build.outputs.digest }}" - touch "${{ runner.temp }}/digests/${digest#sha256:}" - - - name: Upload digest - uses: actions/upload-artifact@v4 - with: - name: digests-fastgpt-mcp_server-${{ github.sha }}-${{ matrix.arch }} - path: ${{ runner.temp }}/digests/* - if-no-files-found: error - retention-days: 1 - - release-fastgpt-mcp_server-images: - permissions: - packages: write - contents: read - attestations: write - id-token: write - needs: build-fastgpt-mcp_server-images - runs-on: ubuntu-24.04 - steps: - - name: Login to GitHub Container Registry - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.repository_owner }} - password: ${{ secrets.GITHUB_TOKEN }} - - name: Login to Ali Hub - uses: docker/login-action@v3 - with: - registry: registry.cn-hangzhou.aliyuncs.com - username: ${{ secrets.ALI_HUB_USERNAME }} - password: ${{ secrets.ALI_HUB_PASSWORD }} - - name: Login to Docker Hub - uses: docker/login-action@v3 - with: - username: ${{ secrets.DOCKER_HUB_NAME }} - password: ${{ secrets.DOCKER_HUB_PASSWORD }} - - - name: Download digests - uses: actions/download-artifact@v4 - with: - path: ${{ runner.temp }}/digests - pattern: digests-fastgpt-mcp_server-${{ github.sha }}-* - merge-multiple: true - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - - name: Set image name and tag - run: | - if [[ "${{ github.ref_name }}" == "main" ]]; then - echo "Git_Tag=ghcr.io/${{ github.repository_owner }}/fastgpt-mcp_server:latest" >> $GITHUB_ENV - echo "Git_Latest=ghcr.io/${{ github.repository_owner }}/fastgpt-mcp_server:latest" >> $GITHUB_ENV - echo "Ali_Tag=${{ secrets.ALI_IMAGE_NAME }}/fastgpt-mcp_server:latest" >> $GITHUB_ENV - echo "Ali_Latest=${{ secrets.ALI_IMAGE_NAME }}/fastgpt-mcp_server:latest" >> $GITHUB_ENV - echo "Docker_Hub_Tag=${{ secrets.DOCKER_IMAGE_NAME }}/fastgpt-mcp_server:latest" >> $GITHUB_ENV - echo "Docker_Hub_Latest=${{ secrets.DOCKER_IMAGE_NAME }}/fastgpt-mcp_server:latest" >> $GITHUB_ENV - else - echo "Git_Tag=ghcr.io/${{ github.repository_owner }}/fastgpt-mcp_server:${{ github.ref_name }}" >> $GITHUB_ENV - echo "Git_Latest=ghcr.io/${{ github.repository_owner }}/fastgpt-mcp_server:latest" >> $GITHUB_ENV - echo "Ali_Tag=${{ secrets.ALI_IMAGE_NAME }}/fastgpt-mcp_server:${{ github.ref_name }}" >> $GITHUB_ENV - echo "Ali_Latest=${{ secrets.ALI_IMAGE_NAME }}/fastgpt-mcp_server:latest" >> $GITHUB_ENV - echo "Docker_Hub_Tag=${{ secrets.DOCKER_IMAGE_NAME }}/fastgpt-mcp_server:${{ github.ref_name }}" >> $GITHUB_ENV - echo "Docker_Hub_Latest=${{ secrets.DOCKER_IMAGE_NAME }}/fastgpt-mcp_server:latest" >> $GITHUB_ENV - fi - - - name: Create manifest list and push - working-directory: ${{ runner.temp }}/digests - run: | - TAGS="$(echo -e "${Git_Tag}\n${Git_Latest}\n${Ali_Tag}\n${Ali_Latest}\n${Docker_Hub_Tag}\n${Docker_Hub_Latest}")" - for TAG in $TAGS; do - docker buildx imagetools create -t $TAG \ - $(printf 'ghcr.io/${{ github.repository_owner }}/fastgpt-mcp_server@sha256:%s ' *) - sleep 5 - done From 08091a96d17f2919013f00d330f564bdb9dc3dab Mon Sep 17 00:00:00 2001 From: filenew1 <819567884@qq.com> Date: Fri, 5 Sep 2025 18:52:37 +0800 Subject: [PATCH 08/14] Delete .github/workflows/sandbox-build-image.yml --- .github/workflows/sandbox-build-image.yml | 151 ---------------------- 1 file changed, 151 deletions(-) delete mode 100644 .github/workflows/sandbox-build-image.yml diff --git a/.github/workflows/sandbox-build-image.yml b/.github/workflows/sandbox-build-image.yml deleted file mode 100644 index 89727bdfd610..000000000000 --- a/.github/workflows/sandbox-build-image.yml +++ /dev/null @@ -1,151 +0,0 @@ -name: Build fastgpt-sandbox images -on: - workflow_dispatch: - push: - paths: - - 'projects/sandbox/**' - tags: - - 'v*' -jobs: - build-fastgpt-sandbox-images: - permissions: - packages: write - contents: read - attestations: write - id-token: write - strategy: - matrix: - include: - - arch: amd64 - - arch: arm64 - runs-on: ubuntu-24.04-arm - runs-on: ${{ matrix.runs-on || 'ubuntu-24.04' }} - steps: - # install env - - name: Checkout - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - with: - driver-opts: network=host - - name: Cache Docker layers - uses: actions/cache@v4 - with: - path: /tmp/.buildx-cache - key: ${{ runner.os }}-sandbox-buildx-${{ github.sha }} - restore-keys: | - ${{ runner.os }}-sandbox-buildx- - - # login docker - - name: Login to GitHub Container Registry - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.repository_owner }} - password: ${{ secrets.GITHUB_TOKEN }} - - name: Login to Ali Hub - uses: docker/login-action@v3 - with: - registry: registry.cn-hangzhou.aliyuncs.com - username: ${{ secrets.ALI_HUB_USERNAME }} - password: ${{ secrets.ALI_HUB_PASSWORD }} - - name: Login to Docker Hub - uses: docker/login-action@v3 - with: - username: ${{ secrets.DOCKER_HUB_NAME }} - password: ${{ secrets.DOCKER_HUB_PASSWORD }} - - - name: Build for ${{ matrix.arch }} - id: build - uses: docker/build-push-action@v6 - with: - context: . - file: projects/sandbox/Dockerfile - platforms: linux/${{ matrix.arch }} - labels: | - org.opencontainers.image.source=https://github.com/${{ github.repository }} - org.opencontainers.image.description=fastgpt-sandbox image - outputs: type=image,"name=ghcr.io/${{ github.repository_owner }}/fastgpt-sandbox,${{ secrets.ALI_IMAGE_NAME }}/fastgpt-sandbox,${{ secrets.DOCKER_IMAGE_NAME }}/fastgpt-sandbox",push-by-digest=true,push=true - cache-from: type=local,src=/tmp/.buildx-cache - cache-to: type=local,dest=/tmp/.buildx-cache - - - name: Export digest - run: | - mkdir -p ${{ runner.temp }}/digests - digest="${{ steps.build.outputs.digest }}" - touch "${{ runner.temp }}/digests/${digest#sha256:}" - - - name: Upload digest - uses: actions/upload-artifact@v4 - with: - name: digests-fastgpt-sandbox-${{ github.sha }}-${{ matrix.arch }} - path: ${{ runner.temp }}/digests/* - if-no-files-found: error - retention-days: 1 - - release-fastgpt-sandbox-images: - permissions: - packages: write - contents: read - attestations: write - id-token: write - needs: build-fastgpt-sandbox-images - runs-on: ubuntu-24.04 - steps: - - name: Login to GitHub Container Registry - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.repository_owner }} - password: ${{ secrets.GITHUB_TOKEN }} - - name: Login to Ali Hub - uses: docker/login-action@v3 - with: - registry: registry.cn-hangzhou.aliyuncs.com - username: ${{ secrets.ALI_HUB_USERNAME }} - password: ${{ secrets.ALI_HUB_PASSWORD }} - - name: Login to Docker Hub - uses: docker/login-action@v3 - with: - username: ${{ secrets.DOCKER_HUB_NAME }} - password: ${{ secrets.DOCKER_HUB_PASSWORD }} - - - name: Download digests - uses: actions/download-artifact@v4 - with: - path: ${{ runner.temp }}/digests - pattern: digests-fastgpt-sandbox-${{ github.sha }}-* - merge-multiple: true - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - - name: Set image name and tag - run: | - if [[ "${{ github.ref_name }}" == "main" ]]; then - echo "Git_Tag=ghcr.io/${{ github.repository_owner }}/fastgpt-sandbox:latest" >> $GITHUB_ENV - echo "Git_Latest=ghcr.io/${{ github.repository_owner }}/fastgpt-sandbox:latest" >> $GITHUB_ENV - echo "Ali_Tag=${{ secrets.ALI_IMAGE_NAME }}/fastgpt-sandbox:latest" >> $GITHUB_ENV - echo "Ali_Latest=${{ secrets.ALI_IMAGE_NAME }}/fastgpt-sandbox:latest" >> $GITHUB_ENV - echo "Docker_Hub_Tag=${{ secrets.DOCKER_IMAGE_NAME }}/fastgpt-sandbox:latest" >> $GITHUB_ENV - echo "Docker_Hub_Latest=${{ secrets.DOCKER_IMAGE_NAME }}/fastgpt-sandbox:latest" >> $GITHUB_ENV - else - echo "Git_Tag=ghcr.io/${{ github.repository_owner }}/fastgpt-sandbox:${{ github.ref_name }}" >> $GITHUB_ENV - echo "Git_Latest=ghcr.io/${{ github.repository_owner }}/fastgpt-sandbox:latest" >> $GITHUB_ENV - echo "Ali_Tag=${{ secrets.ALI_IMAGE_NAME }}/fastgpt-sandbox:${{ github.ref_name }}" >> $GITHUB_ENV - echo "Ali_Latest=${{ secrets.ALI_IMAGE_NAME }}/fastgpt-sandbox:latest" >> $GITHUB_ENV - echo "Docker_Hub_Tag=${{ secrets.DOCKER_IMAGE_NAME }}/fastgpt-sandbox:${{ github.ref_name }}" >> $GITHUB_ENV - echo "Docker_Hub_Latest=${{ secrets.DOCKER_IMAGE_NAME }}/fastgpt-sandbox:latest" >> $GITHUB_ENV - fi - - - name: Create manifest list and push - working-directory: ${{ runner.temp }}/digests - run: | - TAGS="$(echo -e "${Git_Tag}\n${Git_Latest}\n${Ali_Tag}\n${Ali_Latest}\n${Docker_Hub_Tag}\n${Docker_Hub_Latest}")" - for TAG in $TAGS; do - docker buildx imagetools create -t $TAG \ - $(printf 'ghcr.io/${{ github.repository_owner }}/fastgpt-sandbox@sha256:%s ' *) - sleep 5 - done From b0493e5576fa45b407a750bae79f9f7bd7a67427 Mon Sep 17 00:00:00 2001 From: filenew1 <819567884@qq.com> Date: Fri, 5 Sep 2025 18:59:23 +0800 Subject: [PATCH 09/14] Update fastgpt-build-image.yml --- .github/workflows/fastgpt-build-image.yml | 77 +++++++++-------------- 1 file changed, 29 insertions(+), 48 deletions(-) diff --git a/.github/workflows/fastgpt-build-image.yml b/.github/workflows/fastgpt-build-image.yml index fe6226ab33f0..1957fe338c82 100644 --- a/.github/workflows/fastgpt-build-image.yml +++ b/.github/workflows/fastgpt-build-image.yml @@ -1,4 +1,4 @@ -name: Build FastGPT images +name: Build FastGPT images for Aliyun on: workflow_dispatch: @@ -7,20 +7,17 @@ on: - "projects/app/**" - "packages/**" tags: - - "v*" + - "*v*" jobs: build-fastgpt-images: permissions: - packages: write contents: read - attestations: write - id-token: write strategy: matrix: sub_routes: - repo: fastgpt - base_url: "" + base_url: "/fastai" - repo: fastgpt-sub-route base_url: "/fastai" - repo: fastgpt-sub-route-gchat @@ -31,17 +28,19 @@ jobs: runs-on: ubuntu-24.04-arm runs-on: ${{ matrix.archs.runs-on || 'ubuntu-24.04' }} steps: - # install env + # 检出代码 - name: Checkout uses: actions/checkout@v4 with: fetch-depth: 1 + # 设置Docker Buildx - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 with: driver-opts: network=host + # 缓存Docker层 - name: Cache Docker layers uses: actions/cache@v4 with: @@ -50,25 +49,15 @@ jobs: restore-keys: | ${{ runner.os }}-${{ matrix.archs.arch }}-${{ matrix.sub_routes.repo }}-buildx- - # login docker - - name: Login to GitHub Container Registry - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.repository_owner }} - password: ${{ secrets.GITHUB_TOKEN }} + # 仅登录阿里云容器仓库 - name: Login to Ali Hub uses: docker/login-action@v3 with: - registry: registry.cn-hangzhou.aliyuncs.com + registry: crpi-u16o47qf6y5a1bqg.cn-shenzhen.personal.cr.aliyuncs.com username: ${{ secrets.ALI_HUB_USERNAME }} password: ${{ secrets.ALI_HUB_PASSWORD }} - - name: Login to Docker Hub - uses: docker/login-action@v3 - with: - username: ${{ secrets.DOCKER_HUB_NAME }} - password: ${{ secrets.DOCKER_HUB_PASSWORD }} + # 构建镜像 - name: Build for ${{ matrix.archs.arch }} id: build uses: docker/build-push-action@v6 @@ -81,16 +70,18 @@ jobs: labels: | org.opencontainers.image.source=https://github.com/${{ github.repository }} org.opencontainers.image.description=${{ matrix.sub_routes.repo }} image - outputs: type=image,"name=ghcr.io/${{ github.repository_owner }}/${{ matrix.sub_routes.repo }},${{ secrets.ALI_IMAGE_NAME }}/${{ matrix.sub_routes.repo }},${{ secrets.DOCKER_IMAGE_NAME }}/${{ matrix.sub_routes.repo }}",push-by-digest=true,push=true + outputs: type=image,"name=${{ secrets.ALI_IMAGE_NAME }}/${{ matrix.sub_routes.repo }}",push-by-digest=true,push=true cache-from: type=local,src=/tmp/.buildx-cache cache-to: type=local,dest=/tmp/.buildx-cache + # 导出镜像摘要 - name: Export digest run: | mkdir -p ${{ runner.temp }}/digests/${{ matrix.sub_routes.repo }} digest="${{ steps.build.outputs.digest }}" touch "${{ runner.temp }}/digests/${{ matrix.sub_routes.repo }}/${digest#sha256:}" + # 上传镜像摘要作为工件 - name: Upload digest uses: actions/upload-artifact@v4 with: @@ -101,10 +92,7 @@ jobs: release-fastgpt-images: permissions: - packages: write contents: read - attestations: write - id-token: write needs: build-fastgpt-images strategy: matrix: @@ -114,24 +102,15 @@ jobs: - repo: fastgpt-sub-route-gchat runs-on: ubuntu-24.04 steps: - - name: Login to GitHub Container Registry - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.repository_owner }} - password: ${{ secrets.GITHUB_TOKEN }} + # 登录阿里云容器仓库 - name: Login to Ali Hub uses: docker/login-action@v3 with: - registry: registry.cn-hangzhou.aliyuncs.com + registry: crpi-u16o47qf6y5a1bqg.cn-shenzhen.personal.cr.aliyuncs.com username: ${{ secrets.ALI_HUB_USERNAME }} password: ${{ secrets.ALI_HUB_PASSWORD }} - - name: Login to Docker Hub - uses: docker/login-action@v3 - with: - username: ${{ secrets.DOCKER_HUB_NAME }} - password: ${{ secrets.DOCKER_HUB_PASSWORD }} + # 下载镜像摘要 - name: Download digests uses: actions/download-artifact@v4 with: @@ -139,33 +118,35 @@ jobs: pattern: digests-${{ matrix.sub_routes.repo }}-${{ github.sha }}-* merge-multiple: true + # 设置Docker Buildx - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 + # 设置镜像名称和标签 - name: Set image name and tag run: | if [[ "${{ github.ref_name }}" == "main" ]]; then - echo "Git_Tag=ghcr.io/${{ github.repository_owner }}/${{ matrix.sub_routes.repo }}:latest" >> $GITHUB_ENV - echo "Git_Latest=ghcr.io/${{ github.repository_owner }}/${{ matrix.sub_routes.repo }}:latest" >> $GITHUB_ENV echo "Ali_Tag=${{ secrets.ALI_IMAGE_NAME }}/${{ matrix.sub_routes.repo }}:latest" >> $GITHUB_ENV - echo "Ali_Latest=${{ secrets.ALI_IMAGE_NAME }}/${{ matrix.sub_routes.repo }}:latest" >> $GITHUB_ENV - echo "Docker_Hub_Tag=${{ secrets.DOCKER_IMAGE_NAME }}/${{ matrix.sub_routes.repo }}:latest" >> $GITHUB_ENV - echo "Docker_Hub_Latest=${{ secrets.DOCKER_IMAGE_NAME }}/${{ matrix.sub_routes.repo }}:latest" >> $GITHUB_ENV else - echo "Git_Tag=ghcr.io/${{ github.repository_owner }}/${{ matrix.sub_routes.repo }}:${{ github.ref_name }}" >> $GITHUB_ENV - echo "Git_Latest=ghcr.io/${{ github.repository_owner }}/${{ matrix.sub_routes.repo }}:latest" >> $GITHUB_ENV echo "Ali_Tag=${{ secrets.ALI_IMAGE_NAME }}/${{ matrix.sub_routes.repo }}:${{ github.ref_name }}" >> $GITHUB_ENV echo "Ali_Latest=${{ secrets.ALI_IMAGE_NAME }}/${{ matrix.sub_routes.repo }}:latest" >> $GITHUB_ENV - echo "Docker_Hub_Tag=${{ secrets.DOCKER_IMAGE_NAME }}/${{ matrix.sub_routes.repo }}:${{ github.ref_name }}" >> $GITHUB_ENV - echo "Docker_Hub_Latest=${{ secrets.DOCKER_IMAGE_NAME }}/${{ matrix.sub_routes.repo }}:latest" >> $GITHUB_ENV fi - - name: Create manifest list and push + # 创建镜像清单并推送到阿里云 + - name: Create manifest list and push to Aliyun working-directory: ${{ runner.temp }}/digests run: | - TAGS="$(echo -e "${Git_Tag}\n${Git_Latest}\n${Ali_Tag}\n${Ali_Latest}\n${Docker_Hub_Tag}\n${Docker_Hub_Latest}")" + # 基础标签 + TAGS="${Ali_Tag}" + + # 如果不是main分支,还需要推送latest标签 + if [[ "${{ github.ref_name }}" != "main" ]]; then + TAGS="${TAGS} ${Ali_Latest}" + fi + + # 为每个标签创建多架构镜像清单 for TAG in $TAGS; do docker buildx imagetools create -t $TAG \ - $(printf 'ghcr.io/${{ github.repository_owner }}/${{ matrix.sub_routes.repo }}@sha256:%s ' *) + $(printf '${{ secrets.ALI_IMAGE_NAME }}/${{ matrix.sub_routes.repo }}@sha256:%s ' *) sleep 5 done From c22856a79340544230e340362898bb137f6f6c1c Mon Sep 17 00:00:00 2001 From: filenew1 <819567884@qq.com> Date: Fri, 5 Sep 2025 19:09:19 +0800 Subject: [PATCH 10/14] Update fastgpt-build-image.yml --- .github/workflows/fastgpt-build-image.yml | 112 ++++------------------ 1 file changed, 19 insertions(+), 93 deletions(-) diff --git a/.github/workflows/fastgpt-build-image.yml b/.github/workflows/fastgpt-build-image.yml index 1957fe338c82..623f51794163 100644 --- a/.github/workflows/fastgpt-build-image.yml +++ b/.github/workflows/fastgpt-build-image.yml @@ -7,7 +7,10 @@ on: - "projects/app/**" - "packages/**" tags: - - "*v*" + - "*fastgpt*" + +env: + IMAGE_NAME: fastgpt # 镜像名(不含 registry 与 namespace) jobs: build-fastgpt-images: @@ -49,104 +52,27 @@ jobs: restore-keys: | ${{ runner.os }}-${{ matrix.archs.arch }}-${{ matrix.sub_routes.repo }}-buildx- - # 仅登录阿里云容器仓库 - - name: Login to Ali Hub + # 登录阿里云 ACR(从 Secrets 读取) + - name: Log in to Alibaba Cloud Container Registry uses: docker/login-action@v3 with: - registry: crpi-u16o47qf6y5a1bqg.cn-shenzhen.personal.cr.aliyuncs.com - username: ${{ secrets.ALI_HUB_USERNAME }} - password: ${{ secrets.ALI_HUB_PASSWORD }} + registry: ${{ secrets.ACR_REGISTRY }} # e.g. registry.cn-hangzhou.aliyuncs.com + username: ${{ secrets.ACR_USERNAME }} # 通常为 AccessKeyId + password: ${{ secrets.ACR_PASSWORD }} # 通常为 AccessKeySecret # 构建镜像 - - name: Build for ${{ matrix.archs.arch }} - id: build - uses: docker/build-push-action@v6 + - name: Build and push multi-arch image + uses: docker/build-push-action@v4 with: context: . file: projects/app/Dockerfile - platforms: linux/${{ matrix.archs.arch }} + platforms: linux/amd64,linux/arm64 build-args: | ${{ matrix.sub_routes.base_url && format('base_url={0}', matrix.sub_routes.base_url) || '' }} - labels: | - org.opencontainers.image.source=https://github.com/${{ github.repository }} - org.opencontainers.image.description=${{ matrix.sub_routes.repo }} image - outputs: type=image,"name=${{ secrets.ALI_IMAGE_NAME }}/${{ matrix.sub_routes.repo }}",push-by-digest=true,push=true - cache-from: type=local,src=/tmp/.buildx-cache - cache-to: type=local,dest=/tmp/.buildx-cache - - # 导出镜像摘要 - - name: Export digest - run: | - mkdir -p ${{ runner.temp }}/digests/${{ matrix.sub_routes.repo }} - digest="${{ steps.build.outputs.digest }}" - touch "${{ runner.temp }}/digests/${{ matrix.sub_routes.repo }}/${digest#sha256:}" - - # 上传镜像摘要作为工件 - - name: Upload digest - uses: actions/upload-artifact@v4 - with: - name: digests-${{ matrix.sub_routes.repo }}-${{ github.sha }}-${{ matrix.archs.arch }} - path: ${{ runner.temp }}/digests/${{ matrix.sub_routes.repo }}/* - if-no-files-found: error - retention-days: 1 - - release-fastgpt-images: - permissions: - contents: read - needs: build-fastgpt-images - strategy: - matrix: - sub_routes: - - repo: fastgpt - - repo: fastgpt-sub-route - - repo: fastgpt-sub-route-gchat - runs-on: ubuntu-24.04 - steps: - # 登录阿里云容器仓库 - - name: Login to Ali Hub - uses: docker/login-action@v3 - with: - registry: crpi-u16o47qf6y5a1bqg.cn-shenzhen.personal.cr.aliyuncs.com - username: ${{ secrets.ALI_HUB_USERNAME }} - password: ${{ secrets.ALI_HUB_PASSWORD }} - - # 下载镜像摘要 - - name: Download digests - uses: actions/download-artifact@v4 - with: - path: ${{ runner.temp }}/digests - pattern: digests-${{ matrix.sub_routes.repo }}-${{ github.sha }}-* - merge-multiple: true - - # 设置Docker Buildx - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - # 设置镜像名称和标签 - - name: Set image name and tag - run: | - if [[ "${{ github.ref_name }}" == "main" ]]; then - echo "Ali_Tag=${{ secrets.ALI_IMAGE_NAME }}/${{ matrix.sub_routes.repo }}:latest" >> $GITHUB_ENV - else - echo "Ali_Tag=${{ secrets.ALI_IMAGE_NAME }}/${{ matrix.sub_routes.repo }}:${{ github.ref_name }}" >> $GITHUB_ENV - echo "Ali_Latest=${{ secrets.ALI_IMAGE_NAME }}/${{ matrix.sub_routes.repo }}:latest" >> $GITHUB_ENV - fi - - # 创建镜像清单并推送到阿里云 - - name: Create manifest list and push to Aliyun - working-directory: ${{ runner.temp }}/digests - run: | - # 基础标签 - TAGS="${Ali_Tag}" - - # 如果不是main分支,还需要推送latest标签 - if [[ "${{ github.ref_name }}" != "main" ]]; then - TAGS="${TAGS} ${Ali_Latest}" - fi - - # 为每个标签创建多架构镜像清单 - for TAG in $TAGS; do - docker buildx imagetools create -t $TAG \ - $(printf '${{ secrets.ALI_IMAGE_NAME }}/${{ matrix.sub_routes.repo }}@sha256:%s ' *) - sleep 5 - done + push: true + tags: | + ${{ secrets.ACR_REGISTRY }}/${{ secrets.ACR_NAMESPACE }}/${{ env.IMAGE_NAME }}:${{ github.ref_name }} + ${{ secrets.ACR_REGISTRY }}/${{ secrets.ACR_NAMESPACE }}/${{ env.IMAGE_NAME }}:latest + # 可选缓存,加速后续构建(首次会慢) + cache-from: type=registry,ref=${{ secrets.ACR_REGISTRY }}/${{ secrets.ACR_NAMESPACE }}/${{ env.IMAGE_NAME }}:buildcache + cache-to: type=inline From d342ae21df7d93c643a1119edf703fdd29d853f0 Mon Sep 17 00:00:00 2001 From: filenew1 <819567884@qq.com> Date: Mon, 8 Sep 2025 09:45:51 +0800 Subject: [PATCH 11/14] Update fastgpt-build-image.yml --- .github/workflows/fastgpt-build-image.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/fastgpt-build-image.yml b/.github/workflows/fastgpt-build-image.yml index 623f51794163..68a37b5358c9 100644 --- a/.github/workflows/fastgpt-build-image.yml +++ b/.github/workflows/fastgpt-build-image.yml @@ -26,7 +26,6 @@ jobs: - repo: fastgpt-sub-route-gchat base_url: "/gchat" archs: - - arch: amd64 - arch: arm64 runs-on: ubuntu-24.04-arm runs-on: ${{ matrix.archs.runs-on || 'ubuntu-24.04' }} From c062c2491c34f53f9ac46526484a51d1c5bc306f Mon Sep 17 00:00:00 2001 From: filenew1 <819567884@qq.com> Date: Mon, 8 Sep 2025 09:54:45 +0800 Subject: [PATCH 12/14] Update fastgpt-build-image.yml --- .github/workflows/fastgpt-build-image.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/fastgpt-build-image.yml b/.github/workflows/fastgpt-build-image.yml index 68a37b5358c9..db070b0ced83 100644 --- a/.github/workflows/fastgpt-build-image.yml +++ b/.github/workflows/fastgpt-build-image.yml @@ -61,7 +61,7 @@ jobs: # 构建镜像 - name: Build and push multi-arch image - uses: docker/build-push-action@v4 + uses: docker/build-push-action@v6 with: context: . file: projects/app/Dockerfile From 7877923dd3ce28ddee06e700e5dce0ef33bf3fd5 Mon Sep 17 00:00:00 2001 From: filenew1 <819567884@qq.com> Date: Mon, 8 Sep 2025 16:30:29 +0800 Subject: [PATCH 13/14] Update fastgpt-build-image.yml --- .github/workflows/fastgpt-build-image.yml | 112 ++++++++++++++++++---- 1 file changed, 95 insertions(+), 17 deletions(-) diff --git a/.github/workflows/fastgpt-build-image.yml b/.github/workflows/fastgpt-build-image.yml index db070b0ced83..99fe529dc45e 100644 --- a/.github/workflows/fastgpt-build-image.yml +++ b/.github/workflows/fastgpt-build-image.yml @@ -8,10 +8,10 @@ on: - "packages/**" tags: - "*fastgpt*" - env: - IMAGE_NAME: fastgpt # 镜像名(不含 registry 与 namespace) - + IMAGE_NAME: fastgpt # 镜像名(不含 registry 与 namespace) + DOCKERFILE_PATH: projects/app/Dockerfile # Dockerfile 路径(按需修改) + jobs: build-fastgpt-images: permissions: @@ -26,6 +26,7 @@ jobs: - repo: fastgpt-sub-route-gchat base_url: "/gchat" archs: + - arch: amd64 - arch: arm64 runs-on: ubuntu-24.04-arm runs-on: ${{ matrix.archs.runs-on || 'ubuntu-24.04' }} @@ -51,27 +52,104 @@ jobs: restore-keys: | ${{ runner.os }}-${{ matrix.archs.arch }}-${{ matrix.sub_routes.repo }}-buildx- - # 登录阿里云 ACR(从 Secrets 读取) - - name: Log in to Alibaba Cloud Container Registry + # 仅登录阿里云容器仓库 + - name: Login to Ali Hub uses: docker/login-action@v3 with: - registry: ${{ secrets.ACR_REGISTRY }} # e.g. registry.cn-hangzhou.aliyuncs.com - username: ${{ secrets.ACR_USERNAME }} # 通常为 AccessKeyId - password: ${{ secrets.ACR_PASSWORD }} # 通常为 AccessKeySecret + registry: ${{ secrets.ACR_REGISTRY }} + username: ${{ secrets.ACR_USERNAME }} + password: ${{ secrets.ACR_PASSWORD }} # 构建镜像 - - name: Build and push multi-arch image + - name: Build for ${{ matrix.archs.arch }} + id: build uses: docker/build-push-action@v6 with: context: . file: projects/app/Dockerfile - platforms: linux/amd64,linux/arm64 + platforms: linux/${{ matrix.archs.arch }} build-args: | ${{ matrix.sub_routes.base_url && format('base_url={0}', matrix.sub_routes.base_url) || '' }} - push: true - tags: | - ${{ secrets.ACR_REGISTRY }}/${{ secrets.ACR_NAMESPACE }}/${{ env.IMAGE_NAME }}:${{ github.ref_name }} - ${{ secrets.ACR_REGISTRY }}/${{ secrets.ACR_NAMESPACE }}/${{ env.IMAGE_NAME }}:latest - # 可选缓存,加速后续构建(首次会慢) - cache-from: type=registry,ref=${{ secrets.ACR_REGISTRY }}/${{ secrets.ACR_NAMESPACE }}/${{ env.IMAGE_NAME }}:buildcache - cache-to: type=inline + labels: | + org.opencontainers.image.source=https://github.com/${{ github.repository }} + org.opencontainers.image.description=${{ matrix.sub_routes.repo }} image + outputs: type=image,"name=${{ env.IMAGE_NAME }}/${{ matrix.sub_routes.repo }}",push-by-digest=true,push=true + cache-from: type=local,src=/tmp/.buildx-cache + cache-to: type=local,dest=/tmp/.buildx-cache + + # 导出镜像摘要 + - name: Export digest + run: | + mkdir -p ${{ runner.temp }}/digests/${{ matrix.sub_routes.repo }} + digest="${{ steps.build.outputs.digest }}" + touch "${{ runner.temp }}/digests/${{ matrix.sub_routes.repo }}/${digest#sha256:}" + + # 上传镜像摘要作为工件 + - name: Upload digest + uses: actions/upload-artifact@v4 + with: + name: digests-${{ matrix.sub_routes.repo }}-${{ github.sha }}-${{ matrix.archs.arch }} + path: ${{ runner.temp }}/digests/${{ matrix.sub_routes.repo }}/* + if-no-files-found: error + retention-days: 1 + + release-fastgpt-images: + permissions: + contents: read + needs: build-fastgpt-images + strategy: + matrix: + sub_routes: + - repo: fastgpt + - repo: fastgpt-sub-route + - repo: fastgpt-sub-route-gchat + runs-on: ubuntu-24.04 + steps: + # 登录阿里云容器仓库 + - name: Login to Ali Hub + uses: docker/login-action@v3 + with: + registry: ${{ secrets.ACR_REGISTRY }} + username: ${{ secrets.ACR_USERNAME }} + password: ${{ secrets.ACR_PASSWORD }} + + # 下载镜像摘要 + - name: Download digests + uses: actions/download-artifact@v4 + with: + path: ${{ runner.temp }}/digests + pattern: digests-${{ matrix.sub_routes.repo }}-${{ github.sha }}-* + merge-multiple: true + + # 设置Docker Buildx + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + # 设置镜像名称和标签 + - name: Set image name and tag + run: | + if [[ "${{ github.ref_name }}" == "main" ]]; then + echo "Ali_Tag=${{ env.IMAGE_NAME }}/${{ matrix.sub_routes.repo }}:latest" >> $GITHUB_ENV + else + echo "Ali_Tag=${{ env.IMAGE_NAME }}/${{ matrix.sub_routes.repo }}:${{ github.ref_name }}" >> $GITHUB_ENV + echo "Ali_Latest=${{ env.IMAGE_NAME }}/${{ matrix.sub_routes.repo }}:latest" >> $GITHUB_ENV + fi + + # 创建镜像清单并推送到阿里云 + - name: Create manifest list and push to Aliyun + working-directory: ${{ runner.temp }}/digests + run: | + # 基础标签 + TAGS="${Ali_Tag}" + + # 如果不是main分支,还需要推送latest标签 + if [[ "${{ github.ref_name }}" != "main" ]]; then + TAGS="${TAGS} ${Ali_Latest}" + fi + + # 为每个标签创建多架构镜像清单 + for TAG in $TAGS; do + docker buildx imagetools create -t $TAG \ + $(printf '${{ env.IMAGE_NAME }}/${{ matrix.sub_routes.repo }}@sha256:%s ' *) + sleep 5 + done From 6573dfd6d9acb32674f3e2899538fb5c8e2b538f Mon Sep 17 00:00:00 2001 From: filenew1 <819567884@qq.com> Date: Mon, 8 Sep 2025 16:41:30 +0800 Subject: [PATCH 14/14] Update fastgpt-build-image.yml --- .github/workflows/fastgpt-build-image.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/fastgpt-build-image.yml b/.github/workflows/fastgpt-build-image.yml index 99fe529dc45e..7cf92d24121c 100644 --- a/.github/workflows/fastgpt-build-image.yml +++ b/.github/workflows/fastgpt-build-image.yml @@ -26,7 +26,6 @@ jobs: - repo: fastgpt-sub-route-gchat base_url: "/gchat" archs: - - arch: amd64 - arch: arm64 runs-on: ubuntu-24.04-arm runs-on: ${{ matrix.archs.runs-on || 'ubuntu-24.04' }}