Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 45 additions & 9 deletions .github/workflows/build-docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ on:
required: true
type: string
push:
branches: [ main ]
tags: [ "v*.*.*" ]

env:
Expand Down Expand Up @@ -52,14 +53,24 @@ 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' }}
type=raw,value=main,enable=${{ github.ref == 'refs/heads/main' }}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
Expand All @@ -70,7 +81,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
Expand Down Expand Up @@ -117,14 +130,24 @@ 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' }}
type=raw,value=main,enable=${{ github.ref == 'refs/heads/main' }}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
Expand All @@ -140,20 +163,33 @@ jobs:
env:
SOURCE_TAGS: ${{ steps.meta.outputs.tags }}
run: |
image_refs=()
# Collect image references for both registries
ghcr_image_refs=()
dockerhub_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")")
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

[ ${#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
docker buildx imagetools create \
--tag "$tag" \
"${dockerhub_image_refs[@]}"
fi
done <<< "$SOURCE_TAGS"
51 changes: 42 additions & 9 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 }}
Expand Down Expand Up @@ -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
Expand All @@ -285,20 +305,33 @@ jobs:
env:
SOURCE_TAGS: ${{ steps.meta.outputs.tags }}
run: |
image_refs=()
# Collect image references for both registries
ghcr_image_refs=()
dockerhub_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")")
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

[ ${#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
docker buildx imagetools create \
--tag "$tag" \
"${dockerhub_image_refs[@]}"
fi
done <<< "$SOURCE_TAGS"
5 changes: 3 additions & 2 deletions docs/en/guides/03-deployment.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand All @@ -203,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:
Expand All @@ -221,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
```

Expand Down
Loading