From ce2eecb8b942fdcb62dc4c25cf1b6047ddb004ec Mon Sep 17 00:00:00 2001 From: Alone Date: Thu, 3 Apr 2025 11:30:23 +0800 Subject: [PATCH 1/9] Add docker build workflow --- .github/workflows/build.yml | 112 ++++++++++++++++++++++++++++++++++++ 1 file changed, 112 insertions(+) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..df76c96 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,112 @@ +name: Build Docker Image + +on: + push: + +env: + GITHUB_CR_REPO: ghcr.io/${{ github.repository }} + +jobs: + build: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + platform: + - linux/amd64 + - linux/arm64 + steps: + - name: Prepare + run: | + platform=${{ matrix.platform }} + echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV + + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: | + ${{ env.GITHUB_CR_REPO }} + + - name: Login to GHCR + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Build and push by digest + id: build + uses: docker/build-push-action@v6 + with: + platforms: ${{ matrix.platform }} + labels: ${{ steps.meta.outputs.labels }} + tags: | + ${{ env.GITHUB_CR_REPO }} + build-args: | + TARGETPLATFORM=${{ matrix.platform }} + outputs: type=image,push-by-digest=true,name-canonical=true,push=true + + - 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-${{ env.PLATFORM_PAIR }} + path: ${{ runner.temp }}/digests/* + if-no-files-found: error + retention-days: 1 + + merge: + runs-on: ubuntu-latest + needs: + - build + steps: + - name: Download digests + uses: actions/download-artifact@v4 + with: + path: ${{ runner.temp }}/digests + pattern: digests-* + merge-multiple: true + + - name: Login to GHCR + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: | + ${{ env.GITHUB_CR_REPO }} + tags: | + type=ref,event=branch + type=ref,event=pr + type=semver,pattern={{version}} + type=semver,pattern={{major}} + + - name: Create manifest list and push + working-directory: ${{ runner.temp }}/digests + run: | + docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \ + $(printf '${{ env.GITHUB_CR_REPO }}@sha256:%s ' *) + + - name: Inspect image + run: | + docker buildx imagetools inspect ${{ env.GITHUB_CR_REPO }}:${{ steps.meta.outputs.version }} From 2914bf3dab17dddc22fcf52b97c902c3a4d133ce Mon Sep 17 00:00:00 2001 From: Alone Date: Thu, 3 Apr 2025 11:56:31 +0800 Subject: [PATCH 2/9] Add docker build workflow --- .github/workflows/build.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index df76c96..cfe251b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,7 +1,10 @@ name: Build Docker Image on: - push: + release: + types: + - published + - prereleased env: GITHUB_CR_REPO: ghcr.io/${{ github.repository }} From 333bdcca2206b0c0c5351db99dc33bda0dda5781 Mon Sep 17 00:00:00 2001 From: Alone Date: Thu, 3 Apr 2025 13:00:45 +0800 Subject: [PATCH 3/9] Add docker build workflow --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index cfe251b..e43842e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -3,7 +3,7 @@ name: Build Docker Image on: release: types: - - published + - released - prereleased env: From 0a7f0bc9c96b141c5a7807f4b051f8681ee44d59 Mon Sep 17 00:00:00 2001 From: Alone Date: Thu, 3 Apr 2025 13:04:16 +0800 Subject: [PATCH 4/9] Add docker build workflow --- .github/workflows/build.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e43842e..7325068 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -2,9 +2,7 @@ name: Build Docker Image on: release: - types: - - released - - prereleased + types: [published] env: GITHUB_CR_REPO: ghcr.io/${{ github.repository }} From 87a363cf11df42d2fc86daba8f591e43e74e0201 Mon Sep 17 00:00:00 2001 From: Alone Date: Thu, 3 Apr 2025 13:24:53 +0800 Subject: [PATCH 5/9] Add docker build workflow --- README.md | 5 +++++ docker-compose.yml | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 355ff76..9fd442f 100644 --- a/README.md +++ b/README.md @@ -227,6 +227,11 @@ CHROME_PERSISTENT_SESSION=true docker compose up --build docker compose down ``` +6. **Using precompiled image** + ```bash + docker pull ghcr.io/browser-use/web-ui + ``` + ## Changelog - [x] **2025/01/26:** Thanks to @vvincent1234. Now browser-use-webui can combine with DeepSeek-r1 to engage in deep thinking! - [x] **2025/01/10:** Thanks to @casistack. Now we have Docker Setup option and also Support keep browser open between tasks.[Video tutorial demo](https://github.com/browser-use/web-ui/issues/1#issuecomment-2582511750). diff --git a/docker-compose.yml b/docker-compose.yml index 9c907e6..a00a4d3 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,6 +1,6 @@ services: browser-use-webui: - platform: linux/amd64 + # image: ghcr.io/browser-use/web-ui # Using precompiled image build: context: . dockerfile: ${DOCKERFILE:-Dockerfile} From 56092b8212a015b236f5c6b97a78f2b2ece1449e Mon Sep 17 00:00:00 2001 From: Alone Date: Thu, 3 Apr 2025 14:00:12 +0800 Subject: [PATCH 6/9] Add docker build workflow --- .github/workflows/build.yml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7325068..d6de887 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -102,6 +102,15 @@ jobs: type=semver,pattern={{version}} type=semver,pattern={{major}} + - name: Docker tags + run: | + if [ -z "$DOCKER_METADATA_OUTPUT_VERSION" ]; then + echo DOCKER_METADATA_OUTPUT_VERSION=${{ github.ref_name }} >> $GITHUB_ENV + fi + if [ -z "$DOCKER_METADATA_OUTPUT_JSON" ]; then + echo DOCKER_METADATA_OUTPUT_JSON='{"tags":["${{ github.ref_name }}"]}' >> $GITHUB_ENV + fi + - name: Create manifest list and push working-directory: ${{ runner.temp }}/digests run: | @@ -110,4 +119,4 @@ jobs: - name: Inspect image run: | - docker buildx imagetools inspect ${{ env.GITHUB_CR_REPO }}:${{ steps.meta.outputs.version }} + docker buildx imagetools inspect ${{ env.GITHUB_CR_REPO }}:${{ env.DOCKER_METADATA_OUTPUT_VERSION }} From 1b1bd8804e519bd2787e38174e902061d47e1310 Mon Sep 17 00:00:00 2001 From: Alone Date: Thu, 3 Apr 2025 14:51:12 +0800 Subject: [PATCH 7/9] Add docker build workflow --- .github/workflows/build.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d6de887..2259eb1 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -104,17 +104,17 @@ jobs: - name: Docker tags run: | - if [ -z "$DOCKER_METADATA_OUTPUT_VERSION" ]; then - echo DOCKER_METADATA_OUTPUT_VERSION=${{ github.ref_name }} >> $GITHUB_ENV - fi - if [ -z "$DOCKER_METADATA_OUTPUT_JSON" ]; then - echo DOCKER_METADATA_OUTPUT_JSON='{"tags":["${{ github.ref_name }}"]}' >> $GITHUB_ENV + tags=$(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") + if [ -z "$tags" ]; then + echo "DOCKER_METADATA_OUTPUT_VERSION=${{ github.ref_name }}" >> $GITHUB_ENV + tags="-t ${{ github.ref_name }}" fi + echo "DOCKER_METADATA_TAGS=$tags" >> $GITHUB_ENV - name: Create manifest list and push working-directory: ${{ runner.temp }}/digests run: | - docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \ + docker buildx imagetools create ${{ env.DOCKER_METADATA_TAGS }} \ $(printf '${{ env.GITHUB_CR_REPO }}@sha256:%s ' *) - name: Inspect image From 564edce4d04a1b89f6c8d308f55fb8623a7024a7 Mon Sep 17 00:00:00 2001 From: Alone Date: Thu, 3 Apr 2025 15:11:20 +0800 Subject: [PATCH 8/9] Add docker build workflow --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2259eb1..683b5d5 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -107,7 +107,7 @@ jobs: tags=$(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") if [ -z "$tags" ]; then echo "DOCKER_METADATA_OUTPUT_VERSION=${{ github.ref_name }}" >> $GITHUB_ENV - tags="-t ${{ github.ref_name }}" + tags="-t ${{ env.GITHUB_CR_REPO }}:${{ github.ref_name }}" fi echo "DOCKER_METADATA_TAGS=$tags" >> $GITHUB_ENV From f2e06861908c43b57a4a4735c0ee95a31d80ddfd Mon Sep 17 00:00:00 2001 From: Alone Date: Thu, 3 Apr 2025 15:42:17 +0800 Subject: [PATCH 9/9] Add docker build workflow --- .github/workflows/build.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 683b5d5..87b4173 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -3,6 +3,8 @@ name: Build Docker Image on: release: types: [published] + push: + branches: [main] env: GITHUB_CR_REPO: ghcr.io/${{ github.repository }}