mirror of
https://github.com/open-webui/oikb.git
synced 2026-08-06 23:13:28 +00:00
Some checks failed
Docker (GHCR) / read-version (push) Has been cancelled
Docker (GHCR) / build-dev (amd64, Dockerfile, default, linux/amd64, ubuntu-latest) (push) Has been cancelled
Docker (GHCR) / build-dev (amd64, Dockerfile.alpine, alpine, linux/amd64, ubuntu-latest) (push) Has been cancelled
Docker (GHCR) / build-dev (arm64, Dockerfile, default, linux/arm64, ubuntu-24.04-arm) (push) Has been cancelled
Docker (GHCR) / build-dev (arm64, Dockerfile.alpine, alpine, linux/arm64, ubuntu-24.04-arm) (push) Has been cancelled
Docker (GHCR) / merge-dev (push) Has been cancelled
Docker (GHCR) / merge-dev-alpine (push) Has been cancelled
Docker (GHCR) / build-release (amd64, Dockerfile, default, linux/amd64, ubuntu-latest) (push) Has been cancelled
Docker (GHCR) / build-release (amd64, Dockerfile.alpine, alpine, linux/amd64, ubuntu-latest) (push) Has been cancelled
Docker (GHCR) / build-release (arm64, Dockerfile, default, linux/arm64, ubuntu-24.04-arm) (push) Has been cancelled
Docker (GHCR) / build-release (arm64, Dockerfile.alpine, alpine, linux/arm64, ubuntu-24.04-arm) (push) Has been cancelled
Docker (GHCR) / merge-release (push) Has been cancelled
Docker (GHCR) / merge-release-alpine (push) Has been cancelled
292 lines
8.9 KiB
YAML
292 lines
8.9 KiB
YAML
name: Docker (GHCR)
|
|
|
|
on:
|
|
push:
|
|
branches: [main, release]
|
|
workflow_dispatch:
|
|
|
|
concurrency:
|
|
group: docker-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
env:
|
|
IMAGE: ghcr.io/${{ github.repository }}
|
|
|
|
permissions:
|
|
contents: read
|
|
packages: write
|
|
|
|
jobs:
|
|
read-version:
|
|
if: github.ref == 'refs/heads/release'
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
version: ${{ steps.pkg.outputs.version }}
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Read version
|
|
id: pkg
|
|
run: |
|
|
VERSION=$(python3 -c "
|
|
import re, pathlib
|
|
text = pathlib.Path('pyproject.toml').read_text()
|
|
m = re.search(r'^version\s*=\s*\"([^\"]+)\"', text, re.M)
|
|
print(m.group(1))
|
|
")
|
|
echo "version=$VERSION" >> $GITHUB_OUTPUT
|
|
|
|
build-dev:
|
|
if: github.ref == 'refs/heads/main'
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
- platform: linux/amd64
|
|
runner: ubuntu-latest
|
|
arch: amd64
|
|
flavor: default
|
|
dockerfile: Dockerfile
|
|
- platform: linux/arm64
|
|
runner: ubuntu-24.04-arm
|
|
arch: arm64
|
|
flavor: default
|
|
dockerfile: Dockerfile
|
|
- platform: linux/amd64
|
|
runner: ubuntu-latest
|
|
arch: amd64
|
|
flavor: alpine
|
|
dockerfile: Dockerfile.alpine
|
|
- platform: linux/arm64
|
|
runner: ubuntu-24.04-arm
|
|
arch: arm64
|
|
flavor: alpine
|
|
dockerfile: Dockerfile.alpine
|
|
runs-on: ${{ matrix.runner }}
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Log in to GHCR
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: ghcr.io
|
|
username: ${{ github.actor }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Build and push ${{ matrix.platform }} dev image by digest
|
|
id: build
|
|
uses: docker/build-push-action@v6
|
|
with:
|
|
context: .
|
|
file: ${{ matrix.dockerfile }}
|
|
platforms: ${{ matrix.platform }}
|
|
outputs: type=image,name=${{ env.IMAGE }},push-by-digest=true,name-canonical=true,push=true
|
|
cache-from: type=gha,scope=dev-${{ matrix.flavor }}-${{ matrix.arch }}
|
|
cache-to: type=gha,mode=max,scope=dev-${{ matrix.flavor }}-${{ matrix.arch }}
|
|
|
|
- name: Export digest
|
|
run: |
|
|
mkdir -p /tmp/digests
|
|
digest="${{ steps.build.outputs.digest }}"
|
|
touch "/tmp/digests/${digest#sha256:}"
|
|
|
|
- name: Upload digest
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: digests-dev-${{ matrix.flavor }}-${{ matrix.arch }}
|
|
path: /tmp/digests/*
|
|
if-no-files-found: error
|
|
retention-days: 1
|
|
|
|
merge-dev:
|
|
if: github.ref == 'refs/heads/main'
|
|
needs: build-dev
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Download digests
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
path: /tmp/digests
|
|
pattern: digests-dev-default-*
|
|
merge-multiple: true
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Log in to GHCR
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: ghcr.io
|
|
username: ${{ github.actor }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Create dev multi-arch manifest
|
|
working-directory: /tmp/digests
|
|
run: |
|
|
SHORT_SHA="${GITHUB_SHA::7}"
|
|
tags=("${{ env.IMAGE }}:dev" "${{ env.IMAGE }}:dev-${SHORT_SHA}")
|
|
docker buildx imagetools create $(printf -- '-t %s ' "${tags[@]}") \
|
|
$(printf '${{ env.IMAGE }}@sha256:%s ' *)
|
|
|
|
merge-dev-alpine:
|
|
if: github.ref == 'refs/heads/main'
|
|
needs: build-dev
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Download digests
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
path: /tmp/digests
|
|
pattern: digests-dev-alpine-*
|
|
merge-multiple: true
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Log in to GHCR
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: ghcr.io
|
|
username: ${{ github.actor }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Create dev Alpine multi-arch manifest
|
|
working-directory: /tmp/digests
|
|
run: |
|
|
SHORT_SHA="${GITHUB_SHA::7}"
|
|
tags=("${{ env.IMAGE }}:dev-alpine" "${{ env.IMAGE }}:dev-${SHORT_SHA}-alpine")
|
|
docker buildx imagetools create $(printf -- '-t %s ' "${tags[@]}") \
|
|
$(printf '${{ env.IMAGE }}@sha256:%s ' *)
|
|
|
|
build-release:
|
|
needs: read-version
|
|
if: github.ref == 'refs/heads/release'
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
- platform: linux/amd64
|
|
runner: ubuntu-latest
|
|
arch: amd64
|
|
flavor: default
|
|
dockerfile: Dockerfile
|
|
- platform: linux/arm64
|
|
runner: ubuntu-24.04-arm
|
|
arch: arm64
|
|
flavor: default
|
|
dockerfile: Dockerfile
|
|
- platform: linux/amd64
|
|
runner: ubuntu-latest
|
|
arch: amd64
|
|
flavor: alpine
|
|
dockerfile: Dockerfile.alpine
|
|
- platform: linux/arm64
|
|
runner: ubuntu-24.04-arm
|
|
arch: arm64
|
|
flavor: alpine
|
|
dockerfile: Dockerfile.alpine
|
|
runs-on: ${{ matrix.runner }}
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Log in to GHCR
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: ghcr.io
|
|
username: ${{ github.actor }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Build and push ${{ matrix.platform }} release image by digest
|
|
id: build
|
|
uses: docker/build-push-action@v6
|
|
with:
|
|
context: .
|
|
file: ${{ matrix.dockerfile }}
|
|
platforms: ${{ matrix.platform }}
|
|
outputs: type=image,name=${{ env.IMAGE }},push-by-digest=true,name-canonical=true,push=true
|
|
cache-from: type=gha,scope=release-${{ matrix.flavor }}-${{ matrix.arch }}
|
|
cache-to: type=gha,mode=max,scope=release-${{ matrix.flavor }}-${{ matrix.arch }}
|
|
|
|
- name: Export digest
|
|
run: |
|
|
mkdir -p /tmp/digests
|
|
digest="${{ steps.build.outputs.digest }}"
|
|
touch "/tmp/digests/${digest#sha256:}"
|
|
|
|
- name: Upload digest
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: digests-release-${{ matrix.flavor }}-${{ matrix.arch }}
|
|
path: /tmp/digests/*
|
|
if-no-files-found: error
|
|
retention-days: 1
|
|
|
|
merge-release:
|
|
needs: [read-version, build-release]
|
|
if: github.ref == 'refs/heads/release'
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Download digests
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
path: /tmp/digests
|
|
pattern: digests-release-default-*
|
|
merge-multiple: true
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Log in to GHCR
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: ghcr.io
|
|
username: ${{ github.actor }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Create release multi-arch manifest
|
|
working-directory: /tmp/digests
|
|
run: |
|
|
VERSION="${{ needs.read-version.outputs.version }}"
|
|
MAJOR_MINOR="${VERSION%.*}"
|
|
tags=("${{ env.IMAGE }}:latest" "${{ env.IMAGE }}:${VERSION}" "${{ env.IMAGE }}:${MAJOR_MINOR}")
|
|
docker buildx imagetools create $(printf -- '-t %s ' "${tags[@]}") \
|
|
$(printf '${{ env.IMAGE }}@sha256:%s ' *)
|
|
|
|
merge-release-alpine:
|
|
needs: [read-version, build-release]
|
|
if: github.ref == 'refs/heads/release'
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Download digests
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
path: /tmp/digests
|
|
pattern: digests-release-alpine-*
|
|
merge-multiple: true
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Log in to GHCR
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: ghcr.io
|
|
username: ${{ github.actor }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Create release Alpine multi-arch manifest
|
|
working-directory: /tmp/digests
|
|
run: |
|
|
VERSION="${{ needs.read-version.outputs.version }}"
|
|
MAJOR_MINOR="${VERSION%.*}"
|
|
tags=("${{ env.IMAGE }}:alpine" "${{ env.IMAGE }}:latest-alpine" "${{ env.IMAGE }}:${VERSION}-alpine" "${{ env.IMAGE }}:${MAJOR_MINOR}-alpine")
|
|
docker buildx imagetools create $(printf -- '-t %s ' "${tags[@]}") \
|
|
$(printf '${{ env.IMAGE }}@sha256:%s ' *)
|