From d0786a4040ab519668a196e8e2bcbdd6d8c6a1ff Mon Sep 17 00:00:00 2001 From: openviking Date: Sun, 5 Apr 2026 16:19:53 +0800 Subject: [PATCH 1/4] chore: add docker hup push --- .github/workflows/build-docker-image.yml | 49 +++++++++++++++++++----- .github/workflows/release.yml | 49 +++++++++++++++++++----- docs/en/guides/03-deployment.md | 1 + 3 files changed, 81 insertions(+), 18 deletions(-) diff --git a/.github/workflows/build-docker-image.yml b/.github/workflows/build-docker-image.yml index 4845ddce7..6c9c7e0e1 100644 --- a/.github/workflows/build-docker-image.yml +++ b/.github/workflows/build-docker-image.yml @@ -52,14 +52,23 @@ jobs: username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} + - name: Log in to Docker Hub + uses: docker/login-action@v4 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Extract metadata (tags, labels) for Docker id: meta uses: docker/metadata-action@v6 with: - images: ${{ env.REGISTRY }}/${{ steps.image-name.outputs.image }} + images: | + ${{ env.REGISTRY }}/${{ steps.image-name.outputs.image }} + docker.io/${{ secrets.DOCKERHUB_USERNAME }}/openviking tags: | type=raw,value=${{ github.event.inputs.version }},enable=${{ github.event_name == 'workflow_dispatch' }} type=ref,event=tag,enable=${{ github.ref_type == 'tag' }} + type=raw,value=latest,enable=${{ github.ref_type == 'tag' }} - name: Set up Docker Buildx uses: docker/setup-buildx-action@v4 @@ -70,7 +79,9 @@ jobs: with: context: . platforms: ${{ matrix.platform }} - outputs: type=image,name=${{ env.REGISTRY }}/${{ steps.image-name.outputs.image }},push-by-digest=true,name-canonical=true,push=true + outputs: | + type=image,name=${{ env.REGISTRY }}/${{ steps.image-name.outputs.image }},push-by-digest=true,name-canonical=true,push=true + type=image,name=docker.io/${{ secrets.DOCKERHUB_USERNAME }}/openviking,push-by-digest=true,name-canonical=true,push=true labels: ${{ steps.meta.outputs.labels }} build-args: | # fallback to 0.0.0 if no version is provided @@ -117,14 +128,23 @@ jobs: username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} + - name: Log in to Docker Hub + uses: docker/login-action@v4 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Extract metadata (tags, labels) for Docker id: meta uses: docker/metadata-action@v6 with: - images: ${{ env.REGISTRY }}/${{ steps.image-name.outputs.image }} + images: | + ${{ env.REGISTRY }}/${{ steps.image-name.outputs.image }} + docker.io/${{ secrets.DOCKERHUB_USERNAME }}/openviking tags: | type=raw,value=${{ github.event.inputs.version }},enable=${{ github.event_name == 'workflow_dispatch' }} type=ref,event=tag,enable=${{ github.ref_type == 'tag' }} + type=raw,value=latest,enable=${{ github.ref_type == 'tag' }} - name: Set up Docker Buildx uses: docker/setup-buildx-action@v4 @@ -140,20 +160,31 @@ jobs: env: SOURCE_TAGS: ${{ steps.meta.outputs.tags }} run: | - image_refs=() + # Collect GHCR image references + ghcr_image_refs=() for digest_file in /tmp/digests/*; do [ -e "$digest_file" ] || continue - image_refs+=("${{ env.REGISTRY }}/${{ steps.image-name.outputs.image }}@sha256:$(basename "$digest_file")") + ghcr_image_refs+=("${{ env.REGISTRY }}/${{ steps.image-name.outputs.image }}@sha256:$(basename "$digest_file")") done - [ ${#image_refs[@]} -gt 0 ] || { + [ ${#ghcr_image_refs[@]} -gt 0 ] || { echo "No image digests found" >&2 exit 1 } + # Create manifests for all tags while IFS= read -r tag; do [ -n "$tag" ] || continue - docker buildx imagetools create \ - --tag "$tag" \ - "${image_refs[@]}" + + # Determine which registry this tag belongs to + if [[ "$tag" == ghcr.io/* ]]; then + docker buildx imagetools create \ + --tag "$tag" \ + "${ghcr_image_refs[@]}" + elif [[ "$tag" == docker.io/* ]]; then + # For Docker Hub, use the same digests (they were pushed to both registries) + docker buildx imagetools create \ + --tag "$tag" \ + "${ghcr_image_refs[@]}" + fi done <<< "$SOURCE_TAGS" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ec9c51d12..d7d5ba993 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -197,13 +197,22 @@ jobs: username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} + - name: Log in to Docker Hub + uses: docker/login-action@v4 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Extract metadata (tags, labels) for Docker id: meta uses: docker/metadata-action@v6 with: - images: ghcr.io/${{ steps.image-name.outputs.image }} + images: | + ghcr.io/${{ steps.image-name.outputs.image }} + docker.io/${{ secrets.DOCKERHUB_USERNAME }}/openviking tags: | type=raw,value=${{ github.event.release.tag_name }} + type=raw,value=latest - name: Set up Docker Buildx uses: docker/setup-buildx-action@v4 @@ -214,7 +223,9 @@ jobs: with: context: . platforms: ${{ matrix.platform }} - outputs: type=image,name=ghcr.io/${{ steps.image-name.outputs.image }},push-by-digest=true,name-canonical=true,push=true + outputs: | + type=image,name=ghcr.io/${{ steps.image-name.outputs.image }},push-by-digest=true,name-canonical=true,push=true + type=image,name=docker.io/${{ secrets.DOCKERHUB_USERNAME }}/openviking,push-by-digest=true,name-canonical=true,push=true labels: ${{ steps.meta.outputs.labels }} build-args: | OPENVIKING_VERSION=${{ github.event.release.tag_name }} @@ -263,13 +274,22 @@ jobs: username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} + - name: Log in to Docker Hub + uses: docker/login-action@v4 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Extract metadata (tags, labels) for Docker id: meta uses: docker/metadata-action@v6 with: - images: ghcr.io/${{ steps.image-name.outputs.image }} + images: | + ghcr.io/${{ steps.image-name.outputs.image }} + docker.io/${{ secrets.DOCKERHUB_USERNAME }}/openviking tags: | type=raw,value=${{ github.event.release.tag_name }} + type=raw,value=latest - name: Set up Docker Buildx uses: docker/setup-buildx-action@v4 @@ -285,20 +305,31 @@ jobs: env: SOURCE_TAGS: ${{ steps.meta.outputs.tags }} run: | - image_refs=() + # Collect GHCR image references + ghcr_image_refs=() for digest_file in /tmp/digests/*; do [ -e "$digest_file" ] || continue - image_refs+=("ghcr.io/${{ steps.image-name.outputs.image }}@sha256:$(basename "$digest_file")") + ghcr_image_refs+=("ghcr.io/${{ steps.image-name.outputs.image }}@sha256:$(basename "$digest_file")") done - [ ${#image_refs[@]} -gt 0 ] || { + [ ${#ghcr_image_refs[@]} -gt 0 ] || { echo "No image digests found" >&2 exit 1 } + # Create manifests for all tags while IFS= read -r tag; do [ -n "$tag" ] || continue - docker buildx imagetools create \ - --tag "$tag" \ - "${image_refs[@]}" + + # Determine which registry this tag belongs to + if [[ "$tag" == ghcr.io/* ]]; then + docker buildx imagetools create \ + --tag "$tag" \ + "${ghcr_image_refs[@]}" + elif [[ "$tag" == docker.io/* ]]; then + # For Docker Hub, use the same digests (they were pushed to both registries) + docker buildx imagetools create \ + --tag "$tag" \ + "${ghcr_image_refs[@]}" + fi done <<< "$SOURCE_TAGS" diff --git a/docs/en/guides/03-deployment.md b/docs/en/guides/03-deployment.md index 8d63b33a4..4da5b3069 100644 --- a/docs/en/guides/03-deployment.md +++ b/docs/en/guides/03-deployment.md @@ -194,6 +194,7 @@ curl http://localhost:1933/api/v1/fs/ls?uri=viking:// \ ### Docker OpenViking provides pre-built Docker images published to GitHub Container Registry: +> ~/.openviking/ov.conf need to be configured correctly first. ```bash docker run -d \ From 5f2d35bd7fee3914857663f1c3ead1799079caaa Mon Sep 17 00:00:00 2001 From: openviking Date: Sun, 5 Apr 2026 16:42:03 +0800 Subject: [PATCH 2/4] chore: add docker main tag update --- .github/workflows/build-docker-image.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/build-docker-image.yml b/.github/workflows/build-docker-image.yml index 6c9c7e0e1..b8fc3bf65 100644 --- a/.github/workflows/build-docker-image.yml +++ b/.github/workflows/build-docker-image.yml @@ -8,6 +8,7 @@ on: required: true type: string push: + branches: [ main ] tags: [ "v*.*.*" ] env: @@ -69,6 +70,7 @@ jobs: type=raw,value=${{ github.event.inputs.version }},enable=${{ github.event_name == 'workflow_dispatch' }} type=ref,event=tag,enable=${{ github.ref_type == 'tag' }} type=raw,value=latest,enable=${{ github.ref_type == 'tag' }} + type=raw,value=main,enable=${{ github.ref == 'refs/heads/main' }} - name: Set up Docker Buildx uses: docker/setup-buildx-action@v4 @@ -145,6 +147,7 @@ jobs: type=raw,value=${{ github.event.inputs.version }},enable=${{ github.event_name == 'workflow_dispatch' }} type=ref,event=tag,enable=${{ github.ref_type == 'tag' }} type=raw,value=latest,enable=${{ github.ref_type == 'tag' }} + type=raw,value=main,enable=${{ github.ref == 'refs/heads/main' }} - name: Set up Docker Buildx uses: docker/setup-buildx-action@v4 From 92bb63b3a47001941ea02e9890831de41245b502 Mon Sep 17 00:00:00 2001 From: openviking Date: Sun, 5 Apr 2026 16:51:55 +0800 Subject: [PATCH 3/4] chore: add docker main tag update --- .github/workflows/build-docker-image.yml | 10 ++++++---- .github/workflows/release.yml | 10 ++++++---- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build-docker-image.yml b/.github/workflows/build-docker-image.yml index b8fc3bf65..e9240f0c4 100644 --- a/.github/workflows/build-docker-image.yml +++ b/.github/workflows/build-docker-image.yml @@ -163,11 +163,14 @@ jobs: env: SOURCE_TAGS: ${{ steps.meta.outputs.tags }} run: | - # Collect GHCR image references + # Collect image references for both registries ghcr_image_refs=() + dockerhub_image_refs=() for digest_file in /tmp/digests/*; do [ -e "$digest_file" ] || continue - ghcr_image_refs+=("${{ env.REGISTRY }}/${{ steps.image-name.outputs.image }}@sha256:$(basename "$digest_file")") + digest="sha256:$(basename "$digest_file")" + ghcr_image_refs+=("${{ env.REGISTRY }}/${{ steps.image-name.outputs.image }}@${digest}") + dockerhub_image_refs+=("docker.io/${{ secrets.DOCKERHUB_USERNAME }}/openviking@${digest}") done [ ${#ghcr_image_refs[@]} -gt 0 ] || { @@ -185,9 +188,8 @@ jobs: --tag "$tag" \ "${ghcr_image_refs[@]}" elif [[ "$tag" == docker.io/* ]]; then - # For Docker Hub, use the same digests (they were pushed to both registries) docker buildx imagetools create \ --tag "$tag" \ - "${ghcr_image_refs[@]}" + "${dockerhub_image_refs[@]}" fi done <<< "$SOURCE_TAGS" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d7d5ba993..045de4d58 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -305,11 +305,14 @@ jobs: env: SOURCE_TAGS: ${{ steps.meta.outputs.tags }} run: | - # Collect GHCR image references + # Collect image references for both registries ghcr_image_refs=() + dockerhub_image_refs=() for digest_file in /tmp/digests/*; do [ -e "$digest_file" ] || continue - ghcr_image_refs+=("ghcr.io/${{ steps.image-name.outputs.image }}@sha256:$(basename "$digest_file")") + digest="sha256:$(basename "$digest_file")" + ghcr_image_refs+=("ghcr.io/${{ steps.image-name.outputs.image }}@${digest}") + dockerhub_image_refs+=("docker.io/${{ secrets.DOCKERHUB_USERNAME }}/openviking@${digest}") done [ ${#ghcr_image_refs[@]} -gt 0 ] || { @@ -327,9 +330,8 @@ jobs: --tag "$tag" \ "${ghcr_image_refs[@]}" elif [[ "$tag" == docker.io/* ]]; then - # For Docker Hub, use the same digests (they were pushed to both registries) docker buildx imagetools create \ --tag "$tag" \ - "${ghcr_image_refs[@]}" + "${dockerhub_image_refs[@]}" fi done <<< "$SOURCE_TAGS" From 930e93db2219802a9077baef6e2e6380884b3a47 Mon Sep 17 00:00:00 2001 From: openviking Date: Sun, 5 Apr 2026 16:54:39 +0800 Subject: [PATCH 4/4] docs: use latest by default --- docs/en/guides/03-deployment.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/en/guides/03-deployment.md b/docs/en/guides/03-deployment.md index 4da5b3069..e7cbba92b 100644 --- a/docs/en/guides/03-deployment.md +++ b/docs/en/guides/03-deployment.md @@ -204,7 +204,7 @@ docker run -d \ -v ~/.openviking/ov.conf:/app/ov.conf \ -v /var/lib/openviking/data:/app/data \ --restart unless-stopped \ - ghcr.io/volcengine/openviking:main + ghcr.io/volcengine/openviking:latest ``` By default, the Docker image starts: @@ -222,7 +222,7 @@ docker run -d \ -v ~/.openviking/ov.conf:/app/ov.conf \ -v /var/lib/openviking/data:/app/data \ --restart unless-stopped \ - ghcr.io/volcengine/openviking:main \ + ghcr.io/volcengine/openviking:latest \ --without-bot ```