mirror of
https://github.com/qdrant/qdrant.git
synced 2026-07-31 15:11:35 -05:00
48 lines
1.7 KiB
YAML
48 lines
1.7 KiB
YAML
name: Build and push a branch image to ghcr
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
push:
|
|
branches:
|
|
- dev
|
|
|
|
jobs:
|
|
branch-build-and-push:
|
|
runs-on: [self-hosted, linux, x64]
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
ref: ${{ github.ref.name }}
|
|
- name: Build the Docker image
|
|
run: |
|
|
buildx_containers=$(docker container ls -a -qf "name=buildx_buildkit" | tr '\n' ' ')
|
|
buildx_volumes=$(docker volume ls -qf "name=buildx_buildkit" | tr '\n' ' ')
|
|
|
|
if [ -n "$buildx_containers" ]; then
|
|
echo "Buildx containers to delete: $buildx_containers"
|
|
docker container rm -f $buildx_containers
|
|
fi
|
|
|
|
if [ -n "$buildx_volumes" ]; then
|
|
echo "Buildx volumes to delete: $buildx_volumes"
|
|
docker volume rm -f $buildx_volumes
|
|
fi
|
|
|
|
branch=${GITHUB_REF_NAME//\//-} # replace all / with -
|
|
echo "Building branch $branch"
|
|
|
|
# Create build container
|
|
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
|
|
docker buildx create --use
|
|
|
|
# Authenticate on registries
|
|
docker login https://ghcr.io -u qdrant --password ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
# Build regular image for Github Registry
|
|
GITHUB_TAG="-t ghcr.io/qdrant/qdrant:$branch-${{ github.sha }} -t ghcr.io/qdrant/qdrant:$branch"
|
|
|
|
# Pull, retag and push to GitHub packages
|
|
docker buildx build --platform='linux/amd64,linux/arm64' --build-arg GIT_COMMIT_ID=${{ github.sha }} $GITHUB_TAG --push --label "org.opencontainers.image.revision"=${{ github.sha }} .
|
|
|
|
|