forked from qdrant/qdrant
-
Notifications
You must be signed in to change notification settings - Fork 0
47 lines (36 loc) · 1.66 KB
/
dev-docker-image-build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
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 }} .