Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use docker buildx to publish images #3127

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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