From a079c8c0d27970a8b742aa108ae6cddf11b971c0 Mon Sep 17 00:00:00 2001 From: Henry Date: Thu, 6 Nov 2025 22:58:20 +0000 Subject: [PATCH] refactor: Split Docker image CI workflow into registry-specific workflows --- .github/workflows/docker-image-dockerhub.yml | 72 +++++++++++++++++++ .github/workflows/docker-image-ecr.yml | 73 ++++++++++++++++++++ 2 files changed, 145 insertions(+) create mode 100644 .github/workflows/docker-image-dockerhub.yml create mode 100644 .github/workflows/docker-image-ecr.yml diff --git a/.github/workflows/docker-image-dockerhub.yml b/.github/workflows/docker-image-dockerhub.yml new file mode 100644 index 000000000..3752ddc7e --- /dev/null +++ b/.github/workflows/docker-image-dockerhub.yml @@ -0,0 +1,72 @@ +name: Docker Image CI - Docker Hub + +on: + workflow_dispatch: + inputs: + node_version: + description: 'Node.js version to build this image with.' + type: choice + required: true + default: '20' + options: + - '20' + tag_version: + description: 'Tag version of the image to be pushed.' + type: string + required: true + default: 'latest' + +jobs: + docker: + runs-on: ubuntu-latest + steps: + - name: Set default values + id: defaults + run: | + echo "node_version=${{ github.event.inputs.node_version || '20' }}" >> $GITHUB_OUTPUT + echo "tag_version=${{ github.event.inputs.tag_version || 'latest' }}" >> $GITHUB_OUTPUT + + - name: Checkout + uses: actions/checkout@v4.1.1 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3.0.0 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3.0.0 + + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + # ------------------------- + # Build and push main image + # ------------------------- + - name: Build and push main image + uses: docker/build-push-action@v5.3.0 + with: + context: . + file: ./docker/Dockerfile + build-args: | + NODE_VERSION=${{ steps.defaults.outputs.node_version }} + platforms: linux/amd64,linux/arm64 + push: true + tags: | + flowiseai/flowise:${{ steps.defaults.outputs.tag_version }} + + # ------------------------- + # Build and push worker image + # ------------------------- + - name: Build and push worker image + uses: docker/build-push-action@v5.3.0 + with: + context: . + file: docker/worker/Dockerfile + build-args: | + NODE_VERSION=${{ steps.defaults.outputs.node_version }} + platforms: linux/amd64,linux/arm64 + push: true + tags: | + flowiseai/flowise-worker:${{ steps.defaults.outputs.tag_version }} diff --git a/.github/workflows/docker-image-ecr.yml b/.github/workflows/docker-image-ecr.yml new file mode 100644 index 000000000..1fc28fb1d --- /dev/null +++ b/.github/workflows/docker-image-ecr.yml @@ -0,0 +1,73 @@ +name: Docker Image CI - AWS ECR + +on: + workflow_dispatch: + inputs: + environment: + description: 'Environment to push the image to.' + required: true + default: 'dev' + type: choice + options: + - dev + - prod + node_version: + description: 'Node.js version to build this image with.' + type: choice + required: true + default: '20' + options: + - '20' + tag_version: + description: 'Tag version of the image to be pushed.' + type: string + required: true + default: 'latest' + +jobs: + docker: + runs-on: ubuntu-latest + environment: ${{ github.event.inputs.environment }} + steps: + - name: Set default values + id: defaults + run: | + echo "node_version=${{ github.event.inputs.node_version || '20' }}" >> $GITHUB_OUTPUT + echo "tag_version=${{ github.event.inputs.tag_version || 'latest' }}" >> $GITHUB_OUTPUT + + - name: Checkout + uses: actions/checkout@v4.1.1 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3.0.0 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3.0.0 + + - name: Configure AWS Credentials + uses: aws-actions/configure-aws-credentials@v3 + with: + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + aws-region: ${{ secrets.AWS_REGION }} + + - name: Login to Amazon ECR + uses: aws-actions/amazon-ecr-login@v1 + + # ------------------------- + # Build and push main image + # ------------------------- + - name: Build and push main image + uses: docker/build-push-action@v5.3.0 + with: + context: . + file: Dockerfile + build-args: | + NODE_VERSION=${{ steps.defaults.outputs.node_version }} + platforms: linux/amd64,linux/arm64 + push: true + tags: | + ${{ format('{0}.dkr.ecr.{1}.amazonaws.com/flowise:{2}', + secrets.AWS_ACCOUNT_ID, + secrets.AWS_REGION, + steps.defaults.outputs.tag_version) }}