From e6d11de6b517c75f1cc1204c88f6e731a318e5f1 Mon Sep 17 00:00:00 2001 From: STN2H4 <202400300306@mail.sdu.edu.cn> Date: Sun, 2 Aug 2026 23:41:02 +0800 Subject: [PATCH] fix(ci): build Docker Hub images from repository Dockerfile Pin the release matrix to the intended Dockerfiles and assert the mapping in the Docker smoke workflow. Developed collaboratively by the user, MiMo Code, and GPT-5. --- .github/workflows/docker-image-dockerhub.yml | 4 +- .github/workflows/test_docker_build.yml | 56 +++++++++++++++++++- 2 files changed, 57 insertions(+), 3 deletions(-) diff --git a/.github/workflows/docker-image-dockerhub.yml b/.github/workflows/docker-image-dockerhub.yml index 03ef4e414d3..eaf45f75665 100644 --- a/.github/workflows/docker-image-dockerhub.yml +++ b/.github/workflows/docker-image-dockerhub.yml @@ -44,11 +44,11 @@ jobs: matrix: include: - image: flowiseai/flowise - dockerfile: ./docker/Dockerfile + dockerfile: ./Dockerfile platform: linux/amd64 runner: ubuntu-latest - image: flowiseai/flowise - dockerfile: ./docker/Dockerfile + dockerfile: ./Dockerfile platform: linux/arm64 runner: ubuntu-24.04-arm - image: flowiseai/flowise-worker diff --git a/.github/workflows/test_docker_build.yml b/.github/workflows/test_docker_build.yml index ae4b3f3b2d2..b20ad9b1136 100644 --- a/.github/workflows/test_docker_build.yml +++ b/.github/workflows/test_docker_build.yml @@ -9,6 +9,7 @@ on: branches: - '*' workflow_dispatch: + jobs: build: runs-on: ubuntu-latest @@ -16,4 +17,57 @@ jobs: PUPPETEER_SKIP_DOWNLOAD: true steps: - uses: actions/checkout@v6 - - run: docker build --no-cache -t flowise . + + - name: Verify Docker Hub release Dockerfiles + run: | + python - <<'PY' + from pathlib import Path + import re + + workflow = Path('.github/workflows/docker-image-dockerhub.yml').read_text() + entries = re.findall( + r'^\s+- image: (?P\S+)\s+dockerfile: (?P\S+)', + workflow, + re.MULTILINE, + ) + expected = [ + ('flowiseai/flowise', './Dockerfile'), + ('flowiseai/flowise', './Dockerfile'), + ('flowiseai/flowise-worker', 'docker/worker/Dockerfile'), + ('flowiseai/flowise-worker', 'docker/worker/Dockerfile'), + ] + if sorted(entries) != sorted(expected): + raise SystemExit( + f'Docker Hub workflow Dockerfile mapping changed: expected {expected}, got {entries}' + ) + print('Docker Hub release Dockerfile mapping is pinned to the intended build files.') + PY + + - name: Build Docker image + run: docker build --no-cache -t flowise . + + - name: Start container + run: | + docker run -d --name "flowise-test-${GITHUB_RUN_ID}" -p 127.0.0.1:3000:3000 flowise + + - name: Wait for health check + run: | + echo "Waiting for Flowise to become ready..." + for i in $(seq 1 18); do + if curl -sf http://127.0.0.1:3000/api/v1/ping | grep -qx "pong"; then + echo "Flowise is up and responding." + exit 0 + fi + echo "Attempt $i/18: not ready yet, waiting 5s..." + sleep 5 + done + echo "Flowise failed to respond within 90 seconds." + exit 1 + + - name: Print container logs on failure + if: failure() + run: docker logs "flowise-test-${GITHUB_RUN_ID}" || true + + - name: Cleanup + if: always() + run: docker rm -f "flowise-test-${GITHUB_RUN_ID}" || true