mirror of
https://github.com/qdrant/qdrant.git
synced 2026-08-04 17:10:59 -05:00
44 lines
2.0 KiB
YAML
44 lines
2.0 KiB
YAML
name: Build and push a branch gpu image to ghcr
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
branch-gpu-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 images for Github Registry
|
|
GITHUB_TAG_NVIDIA="-t ghcr.io/qdrant/qdrant:$branch-${{ github.sha }}-gpu-nvidia -t ghcr.io/qdrant/qdrant:$branch-gpu-nvidia"
|
|
docker buildx build --platform='linux/amd64' --build-arg GPU=nvidia --build-arg GIT_COMMIT_ID=${{ github.sha }} $GITHUB_TAG_NVIDIA --push --label "org.opencontainers.image.revision"=${{ github.sha }} .
|
|
|
|
GITHUB_TAG_AMD="-t ghcr.io/qdrant/qdrant:$branch-${{ github.sha }}-gpu-amd -t ghcr.io/qdrant/qdrant:$branch-gpu-amd"
|
|
docker buildx build --platform='linux/amd64' --build-arg GPU=amd --build-arg GIT_COMMIT_ID=${{ github.sha }} $GITHUB_TAG_AMD --push --label "org.opencontainers.image.revision"=${{ github.sha }} .
|