From f89ba2243548f056f6f584affe1716e81e891efd Mon Sep 17 00:00:00 2001 From: Alberto Date: Tue, 22 Jun 2021 11:01:21 +0200 Subject: [PATCH] update github action for main image --- .github/workflows/docker-image.yml | 58 ++++++++++++++++++++++++------ 1 file changed, 47 insertions(+), 11 deletions(-) diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index cb13728..305bbe2 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -1,17 +1,53 @@ name: Docker Images CI on: push: - branches: [ main ] + branches: dev + jobs: - build: + buildx: runs-on: ubuntu-latest - env: - DOCKER_BUILDKIT: '1' steps: - - uses: actions/checkout@v2 - - name: Build the Unified Docker image - run: docker build . --file Dockerfile --tag albertoxamin/bang:latest - - name: Log into registry - run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u ${{ secrets.DOCKER_USERNAME }} --password-stdin - - name: Push images - run: docker push albertoxamin/bang:latest + - + name: Checkout + uses: actions/checkout@v2 + - + name: Set up Docker Buildx + uses: crazy-max/ghaction-docker-buildx@v3 + - + name: Cache Docker layers + uses: actions/cache@v2 + id: cache + with: + path: /tmp/.buildx-cache + key: ${{ runner.os }}-buildx-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-buildx- + - + name: Docker Buildx (build) + run: | + docker buildx build \ + --cache-from "type=local,src=/tmp/.buildx-cache" \ + --cache-to "type=local,dest=/tmp/.buildx-cache" \ + --platform linux/amd64,linux/arm/v7,linux/arm64 \ + --output "type=image,push=false" \ + --tag albertoxamin/bang:latest \ + --file ./Dockerfile ./ + - + name: Login to DockerHub + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + - + name: Docker Buildx (push) + run: | + docker buildx build \ + --cache-from "type=local,src=/tmp/.buildx-cache" \ + --platform linux/amd64,linux/arm/v7,linux/arm64 \ + --output "type=image,push=true" \ + --tag albertoxamin/bang:latest \ + --file ./Dockerfile ./ + - + name: Inspect image + run: | + docker buildx imagetools inspect albertoxamin/bang:latest