From 42fc24156172ea9409bd36a75722b4847bda852d Mon Sep 17 00:00:00 2001 From: TR-SLimey <37966924+TR-SLimey@users.noreply.github.com> Date: Fri, 4 Dec 2020 00:49:49 +0000 Subject: [PATCH] Switched to using official Docker buildx action --- .github/workflows/docker-build-and-push.yml | 80 ++++++++++++--------- 1 file changed, 48 insertions(+), 32 deletions(-) diff --git a/.github/workflows/docker-build-and-push.yml b/.github/workflows/docker-build-and-push.yml index 85776e987..deb667481 100644 --- a/.github/workflows/docker-build-and-push.yml +++ b/.github/workflows/docker-build-and-push.yml @@ -11,37 +11,53 @@ jobs: BuildAndPush: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - - name: Set up buildx - uses: crazy-max/ghaction-docker-buildx@v1 + - + name: Checkout + uses: actions/checkout@v2 + - + name: Set up QEMU + uses: docker/setup-qemu-action@v1 + - + name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + - + name: Login to DockerHub + uses: docker/login-action@v1 with: - buildx-version: latest - - - name: Log in to registry - run: echo "${{ secrets.DOCKER_TOKEN }}" | docker login -u $(echo "$DOCKER_HUB_USER") --password-stdin - - - name: Build and push + username: ${{ env.DOCKER_HUB_USER }} + password: ${{ secrets.DOCKER_TOKEN }} + - + name: Build temporary image + id: docker_build_temporary + uses: docker/build-push-action@v2 + with: + context: . + file: ./build/docker/Dockerfile + platforms: linux/amd64,linux/arm64,linux/arm/v7 + push: false + tags: ${{ env.DOCKER_HUB_USER }}/dendrite:latest + - + name: Build monolith image + id: docker_build_monolith + uses: docker/build-push-action@v2 + with: + context: . + file: ./build/docker/Dockerfile.monolith + platforms: linux/amd64,linux/arm64,linux/arm/v7 + push: true + tags: ${{ env.DOCKER_HUB_USER }}/dendrite-monolith:latest + - + name: Build polylith image + id: docker_build_polylith + uses: docker/build-push-action@v2 + with: + context: . + file: ./build/docker/Dockerfile.polylith + platforms: linux/amd64,linux/arm64,linux/arm/v7 + push: true + tags: ${{ env.DOCKER_HUB_USER }}/dendrite-polylith:latest + - + name: Image digest run: | - # Build temporary builder image first and then use it to build monolith and polylith images - for suffix in '' 'monolith' 'polylith'; do - # Name of the repo/image - IMAGE_NAME=$DOCKER_HUB_USER/dendrite$(if [ $suffix != "" ]; then echo "-$suffix"; fi) - - # Strip git ref prefix from version - VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,') - - # Use `latest` insted of `master` - [ "$VERSION" == "master" ] && VERSION=latest - - # Ensure the whole tag is lowercase - IMAGE_NAME=$(echo $IMAGE_NAME | tr '[A-Z]' '[a-z]') - - echo IMAGE_NAME=$IMAGE_NAME - echo VERSION=$VERSION - - docker buildx build --push \ - --file build/docker/Dockerfile$(if [ $suffix != "" ]; then echo ".$suffix"; fi) \ - --tag $IMAGE_NAME:$VERSION \ - --platform linux/amd64,linux/arm/v7,linux/arm64 . - done + echo Monolith image digest - ${{ steps.docker_build_monolith.outputs.digest }} + echo Polylith image digest - ${{ steps.docker_build_polylith.outputs.digest }}