Skip to content

Commit

Permalink
Use docker buildx to publish images
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewslotin committed Jun 16, 2023
1 parent 2e5631f commit dd11c0d
Showing 1 changed file with 28 additions and 18 deletions.
46 changes: 28 additions & 18 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ jobs:
-t $DOCKER_IMAGE_ID .
- name: Check
run: |
docker buildx build --load -t $DOCKER_IMAGE_ID .
docker run $DOCKER_IMAGE_ID version
docker run $DOCKER_IMAGE_ID --help
docker run $DOCKER_IMAGE_ID help
Expand All @@ -170,20 +171,23 @@ jobs:
if: ${{ github.ref == 'refs/heads/master' }}
run: |
echo "Publish as ghcr.io/$GHCR_IMAGE_ID:$VERSION"
docker tag "$DOCKER_IMAGE_ID" "ghcr.io/$GHCR_IMAGE_ID:master"
docker push "ghcr.io/$GHCR_IMAGE_ID:master"
docker buildx build --push \
--platform linux/amd64,linux/arm64 \
-t ghcr.io/$GHCR_IMAGE_ID:master .
- name: Publish tagged version image to ghcr.io
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
run: |
VERSION="${VERSION#v}"
echo "Publish as ghcr.io/$GHCR_IMAGE_ID:$VERSION"
docker tag "$DOCKER_IMAGE_ID" "ghcr.io/$GHCR_IMAGE_ID:$VERSION"
docker push "ghcr.io/$GHCR_IMAGE_ID:$VERSION"
docker buildx build --push \
--platform linux/amd64,linux/arm64 \
-t ghcr.io/$GHCR_IMAGE_ID:$VERSION .
# We also want to tag the latest stable version as latest
if [[ ! "$VERSION" =~ (RC|rc) ]]; then
echo "Publish as ghcr.io/$GHCR_IMAGE_ID:latest"
docker tag "$DOCKER_IMAGE_ID" "ghcr.io/$GHCR_IMAGE_ID:latest"
docker push "ghcr.io/$GHCR_IMAGE_ID:latest"
docker buildx build --push \
--platform linux/amd64,linux/arm64 \
-t ghcr.io/$GHCR_IMAGE_ID:latest .
fi
- name: Log into Docker Hub
Expand All @@ -195,27 +199,33 @@ jobs:
if: ${{ github.ref == 'refs/heads/master' }}
run: |
echo "Publish to Docker Hub as $DOCKER_IMAGE_ID:master and $LI_DOCKER_IMAGE_ID:master"
docker tag "$DOCKER_IMAGE_ID" "$DOCKER_IMAGE_ID:master"
docker tag "$DOCKER_IMAGE_ID" "$LI_DOCKER_IMAGE_ID:master"
docker push "$DOCKER_IMAGE_ID:master"
docker push "$LI_DOCKER_IMAGE_ID:master"
docker buildx build --push \
--platform linux/amd64,linux/arm64 \
-t ghcr.io/$DOCKER_IMAGE_ID:master .
docker buildx build --push \
--platform linux/amd64,linux/arm64 \
-t ghcr.io/$LI_DOCKER_IMAGE_ID:master .
- name: Publish tagged version image to Docker Hub
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
run: |
# We need to push the same image in both the loadimpact and the grafana docker hub orgs
VERSION="${VERSION#v}"
echo "Publish to Docker Hub as $DOCKER_IMAGE_ID:$VERSION and $LI_DOCKER_IMAGE_ID:$VERSION"
docker tag "$DOCKER_IMAGE_ID" "$DOCKER_IMAGE_ID:$VERSION"
docker tag "$DOCKER_IMAGE_ID" "$LI_DOCKER_IMAGE_ID:$VERSION"
docker push "$DOCKER_IMAGE_ID:$VERSION"
docker push "$LI_DOCKER_IMAGE_ID:$VERSION"
docker buildx build --push \
--platform linux/amd64,linux/arm64 \
-t ghcr.io/$DOCKER_IMAGE_ID:$VERSION .
docker buildx build --push \
--platform linux/amd64,linux/arm64 \
-t ghcr.io/$LI_DOCKER_IMAGE_ID:$VERSION .
# We also want to tag the latest stable version as latest
if [[ ! "$VERSION" =~ (RC|rc) ]]; then
echo "Publish to Docker Hub as $DOCKER_IMAGE_ID:latest and $LI_DOCKER_IMAGE_ID:latest"
docker tag "$DOCKER_IMAGE_ID" "$DOCKER_IMAGE_ID:latest"
docker tag "$DOCKER_IMAGE_ID" "$LI_DOCKER_IMAGE_ID:latest"
docker push "$DOCKER_IMAGE_ID:latest"
docker push "$LI_DOCKER_IMAGE_ID:latest"
docker buildx build --push \
--platform linux/amd64,linux/arm64 \
-t ghcr.io/$DOCKER_IMAGE_ID:latest .
docker buildx build --push \
--platform linux/amd64,linux/arm64 \
-t ghcr.io/$LI_DOCKER_IMAGE_ID:latest .
fi
package-windows:
Expand Down

0 comments on commit dd11c0d

Please sign in to comment.