From 37f7d685fe213b74c37726b19d6410b70664db10 Mon Sep 17 00:00:00 2001 From: Kashif Sohail Date: Sun, 12 Dec 2021 18:39:15 +0500 Subject: [PATCH 01/10] buildx integration --- .github/workflows/docker-image.yml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 .github/workflows/docker-image.yml diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml new file mode 100644 index 00000000..3b145a31 --- /dev/null +++ b/.github/workflows/docker-image.yml @@ -0,0 +1,24 @@ +name: ci-builx + +on: + push: + +jobs: + buildx: + runs-on: ubuntu-latest + steps: + - + name: Checkout + uses: actions/checkout@v2 + - + name: Set up Docker Buildx + id: buildx + uses: docker/setup-buildx-action@v1 + - + name: Inspect builder + run: | + echo "Name: ${{ steps.buildx.outputs.name }}" + echo "Endpoint: ${{ steps.buildx.outputs.endpoint }}" + echo "Status: ${{ steps.buildx.outputs.status }}" + echo "Flags: ${{ steps.buildx.outputs.flags }}" + echo "Platforms: ${{ steps.buildx.outputs.platforms }}" From 502dcfb120dc5ce4d63c1685dfdd8c819019cbe1 Mon Sep 17 00:00:00 2001 From: Kashif Sohail Date: Sun, 12 Dec 2021 19:02:47 +0500 Subject: [PATCH 02/10] Update docker-image.yml --- .github/workflows/docker-image.yml | 92 ++++++++++++++++++++++-------- 1 file changed, 68 insertions(+), 24 deletions(-) diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index 3b145a31..7f83bff3 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -1,24 +1,68 @@ -name: ci-builx - -on: - push: - -jobs: - buildx: - runs-on: ubuntu-latest - steps: - - - name: Checkout - uses: actions/checkout@v2 - - - name: Set up Docker Buildx - id: buildx - uses: docker/setup-buildx-action@v1 - - - name: Inspect builder - run: | - echo "Name: ${{ steps.buildx.outputs.name }}" - echo "Endpoint: ${{ steps.buildx.outputs.endpoint }}" - echo "Status: ${{ steps.buildx.outputs.status }}" - echo "Flags: ${{ steps.buildx.outputs.flags }}" - echo "Platforms: ${{ steps.buildx.outputs.platforms }}" +name: Docker Build/Publish Image +on: + push: + branches: [ master ] +jobs: + build: + runs-on: ubuntu-18.04 + env: + DOCKER_REGISTRY: kemansel.azurecr.io + DOCKER_IMAGE: kmansel/express-me + DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} + DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} + DOCKER_TARGET_PLATFORM: linux/arm/v7 + steps: + - name: Checkout the code + uses: actions/checkout@v1 + - name: Set up Docker Buildx + uses: crazy-max/ghaction-docker-buildx@v1 + with: + version: latest + - name: Prepare + if: success() + id: prepare + run: | + echo ::set-output name=docker_platform::${DOCKER_TARGET_PLATFORM} + echo ::set-output name=docker_image::${DOCKER_REGISTRY}/${DOCKER_IMAGE} + echo ::set-output name=version::${GITHUB_RUN_NUMBER} + - name: Docker Login + if: success() + run: | + echo "${DOCKER_PASSWORD}" | docker login ${DOCKER_REGISTRY} --username "${DOCKER_USERNAME}" --password-stdin + - name: Run Buildx (push image) + if: success() + run: | + docker buildx build \ --platform ${{ steps.prepare.outputs.docker_platform }} \ --tag ${{ steps.prepare.outputs.docker_image }}:${{ steps.prepare.outputs.version }} \ --file ./Dockerfile \ --output type=image,push=true .name: Docker Build/Publish Image +on: + push: + branches: [ master ] +jobs: + build: + runs-on: ubuntu-18.04 + env: + DOCKER_IMAGE: kshfse/dashy + DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} + DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} + DOCKER_TARGET_PLATFORM: linux/arm/v7 + steps: + - name: Checkout the code + uses: actions/checkout@v1 + - name: Set up Docker Buildx + uses: crazy-max/ghaction-docker-buildx@v1 + with: + version: latest + - name: Prepare + if: success() + id: prepare + run: | + echo ::set-output name=docker_platform::${DOCKER_TARGET_PLATFORM} + echo ::set-output name=docker_image::${DOCKER_REGISTRY}/${DOCKER_IMAGE} + echo ::set-output name=version::${GITHUB_RUN_NUMBER} + - name: Docker Login + if: success() + run: | + echo "${DOCKER_PASSWORD}" | docker login --username "${DOCKER_USERNAME}" --password-stdin + - name: Run Buildx (push image) + if: success() + run: | + docker buildx build \ --platform ${{ steps.prepare.outputs.docker_platform }} \ --tag ${{ steps.prepare.outputs.docker_image }}:${{ steps.prepare.outputs.version }} \ --file ./docker/Dockerfile-multi-arch \ --output type=image,push=true . From f0883fbf0acda5a1fc26d0b62ae654d2e70f2e66 Mon Sep 17 00:00:00 2001 From: Kashif Sohail Date: Sun, 12 Dec 2021 19:09:26 +0500 Subject: [PATCH 03/10] Update docker-image.yml --- .github/workflows/docker-image.yml | 40 +++--------------------------- 1 file changed, 3 insertions(+), 37 deletions(-) diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index 7f83bff3..e894006b 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -5,42 +5,8 @@ on: jobs: build: runs-on: ubuntu-18.04 - env: - DOCKER_REGISTRY: kemansel.azurecr.io - DOCKER_IMAGE: kmansel/express-me - DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} - DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} - DOCKER_TARGET_PLATFORM: linux/arm/v7 - steps: - - name: Checkout the code - uses: actions/checkout@v1 - - name: Set up Docker Buildx - uses: crazy-max/ghaction-docker-buildx@v1 - with: - version: latest - - name: Prepare - if: success() - id: prepare - run: | - echo ::set-output name=docker_platform::${DOCKER_TARGET_PLATFORM} - echo ::set-output name=docker_image::${DOCKER_REGISTRY}/${DOCKER_IMAGE} - echo ::set-output name=version::${GITHUB_RUN_NUMBER} - - name: Docker Login - if: success() - run: | - echo "${DOCKER_PASSWORD}" | docker login ${DOCKER_REGISTRY} --username "${DOCKER_USERNAME}" --password-stdin - - name: Run Buildx (push image) - if: success() - run: | - docker buildx build \ --platform ${{ steps.prepare.outputs.docker_platform }} \ --tag ${{ steps.prepare.outputs.docker_image }}:${{ steps.prepare.outputs.version }} \ --file ./Dockerfile \ --output type=image,push=true .name: Docker Build/Publish Image -on: - push: - branches: [ master ] -jobs: - build: - runs-on: ubuntu-18.04 - env: - DOCKER_IMAGE: kshfse/dashy + env: + DOCKER_IMAGE: kshfse/dashy DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} DOCKER_TARGET_PLATFORM: linux/arm/v7 @@ -65,4 +31,4 @@ jobs: - name: Run Buildx (push image) if: success() run: | - docker buildx build \ --platform ${{ steps.prepare.outputs.docker_platform }} \ --tag ${{ steps.prepare.outputs.docker_image }}:${{ steps.prepare.outputs.version }} \ --file ./docker/Dockerfile-multi-arch \ --output type=image,push=true . + docker buildx build --platform ${{ steps.prepare.outputs.docker_platform }} --tag ${{ steps.prepare.outputs.docker_image }}:${{ steps.prepare.outputs.version }} --file ./docker/Dockerfile-multi-arch --output type=image,push=true . From e4df3724271f71e4b5a6553938eeb363b816bcac Mon Sep 17 00:00:00 2001 From: Kashif Sohail Date: Sun, 12 Dec 2021 19:13:21 +0500 Subject: [PATCH 04/10] Create docker-image.yml --- .github/workflows/docker-image.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index e894006b..a6b02089 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -9,7 +9,7 @@ jobs: DOCKER_IMAGE: kshfse/dashy DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} - DOCKER_TARGET_PLATFORM: linux/arm/v7 + TARGETPLATFORM: linux/arm/v7 steps: - name: Checkout the code uses: actions/checkout@v1 @@ -21,7 +21,7 @@ jobs: if: success() id: prepare run: | - echo ::set-output name=docker_platform::${DOCKER_TARGET_PLATFORM} + echo ::set-output name=docker_platform::${TARGETPLATFORM} echo ::set-output name=docker_image::${DOCKER_REGISTRY}/${DOCKER_IMAGE} echo ::set-output name=version::${GITHUB_RUN_NUMBER} - name: Docker Login @@ -31,4 +31,4 @@ jobs: - name: Run Buildx (push image) if: success() run: | - docker buildx build --platform ${{ steps.prepare.outputs.docker_platform }} --tag ${{ steps.prepare.outputs.docker_image }}:${{ steps.prepare.outputs.version }} --file ./docker/Dockerfile-multi-arch --output type=image,push=true . + docker buildx build --platform ${{ steps.prepare.outputs.docker_platform }} --tag ksfhse/dashy:latest --file ./docker/Dockerfile-multi-arch --output type=image,push=true . From 756a50d05408b806f8b05cb0a81071f38a99f95f Mon Sep 17 00:00:00 2001 From: Kashif Sohail Date: Sun, 12 Dec 2021 19:33:46 +0500 Subject: [PATCH 05/10] Update docker-image.yml --- .github/workflows/docker-image.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index a6b02089..fb39160e 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -31,4 +31,6 @@ jobs: - name: Run Buildx (push image) if: success() run: | - docker buildx build --platform ${{ steps.prepare.outputs.docker_platform }} --tag ksfhse/dashy:latest --file ./docker/Dockerfile-multi-arch --output type=image,push=true . + docker buildx build --platform ${{ steps.prepare.outputs.docker_platform }} --tag kshfse/dashy:latest --build-arg TARGETPLATFORM=${{TARGETPLATFORM}} --file ./docker/Dockerfile-multi-arch --output type=image,push=true . + + docker buildx build --platform ${{ steps.prepare.outputs.docker_platform }} --tag kshfse/dashy:latest --build-arg TARGETPLATFORM=linux/arm64 --file ./docker/Dockerfile-multi-arch --output type=image,push=true . From 93a1e6becbb4dec84a18271a2e6831a9920aceb8 Mon Sep 17 00:00:00 2001 From: Kashif Sohail Date: Sun, 12 Dec 2021 19:37:42 +0500 Subject: [PATCH 06/10] Update docker-image.yml --- .github/workflows/docker-image.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index fb39160e..c646508a 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -31,6 +31,6 @@ jobs: - name: Run Buildx (push image) if: success() run: | - docker buildx build --platform ${{ steps.prepare.outputs.docker_platform }} --tag kshfse/dashy:latest --build-arg TARGETPLATFORM=${{TARGETPLATFORM}} --file ./docker/Dockerfile-multi-arch --output type=image,push=true . + docker buildx build --platform ${{ steps.prepare.outputs.docker_platform }} --tag kshfse/dashy:latest --build-arg TARGETPLATFORM=${TARGETPLATFORM} --file ./docker/Dockerfile-multi-arch --output type=image,push=true . docker buildx build --platform ${{ steps.prepare.outputs.docker_platform }} --tag kshfse/dashy:latest --build-arg TARGETPLATFORM=linux/arm64 --file ./docker/Dockerfile-multi-arch --output type=image,push=true . From e8699785161028e8d1ff23eedf23ffcd289bab6e Mon Sep 17 00:00:00 2001 From: Kashif Sohail Date: Sun, 12 Dec 2021 20:10:07 +0500 Subject: [PATCH 07/10] Multi-arch image push --- .github/workflows/docker-image.yml | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index c646508a..74068008 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -16,14 +16,7 @@ jobs: - name: Set up Docker Buildx uses: crazy-max/ghaction-docker-buildx@v1 with: - version: latest - - name: Prepare - if: success() - id: prepare - run: | - echo ::set-output name=docker_platform::${TARGETPLATFORM} - echo ::set-output name=docker_image::${DOCKER_REGISTRY}/${DOCKER_IMAGE} - echo ::set-output name=version::${GITHUB_RUN_NUMBER} + version: latest - name: Docker Login if: success() run: | @@ -31,6 +24,6 @@ jobs: - name: Run Buildx (push image) if: success() run: | - docker buildx build --platform ${{ steps.prepare.outputs.docker_platform }} --tag kshfse/dashy:latest --build-arg TARGETPLATFORM=${TARGETPLATFORM} --file ./docker/Dockerfile-multi-arch --output type=image,push=true . + docker buildx build --platform linux/arm/v7 --tag kshfse/dashy:latest --build-arg TARGETPLATFORM=${TARGETPLATFORM} --file ./docker/Dockerfile-multi-arch --output type=image,push=true . - docker buildx build --platform ${{ steps.prepare.outputs.docker_platform }} --tag kshfse/dashy:latest --build-arg TARGETPLATFORM=linux/arm64 --file ./docker/Dockerfile-multi-arch --output type=image,push=true . + docker buildx build --platform linux/arm64 --tag kshfse/dashy:latest --build-arg TARGETPLATFORM=linux/arm64 --file ./docker/Dockerfile-multi-arch --output type=image,push=true . From 058a94aa45f1076d7bf657bb4257f159c52aef52 Mon Sep 17 00:00:00 2001 From: Kashif Sohail Date: Tue, 14 Dec 2021 20:36:45 +0500 Subject: [PATCH 08/10] single line multiple platforms --- .github/workflows/docker-image.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index 74068008..480d2353 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -24,6 +24,5 @@ jobs: - name: Run Buildx (push image) if: success() run: | - docker buildx build --platform linux/arm/v7 --tag kshfse/dashy:latest --build-arg TARGETPLATFORM=${TARGETPLATFORM} --file ./docker/Dockerfile-multi-arch --output type=image,push=true . + docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v7 --tag kshfse/dashy:latest --file ./docker/Dockerfile-multi-arch --output type=image,push=true . - docker buildx build --platform linux/arm64 --tag kshfse/dashy:latest --build-arg TARGETPLATFORM=linux/arm64 --file ./docker/Dockerfile-multi-arch --output type=image,push=true . From d6e1cdaf2d654b60c36043175a3c969c7af02e52 Mon Sep 17 00:00:00 2001 From: Kashif Sohail Date: Tue, 14 Dec 2021 21:07:27 +0500 Subject: [PATCH 09/10] used builtin actions. --- .github/workflows/docker-image.yml | 61 +++++++++++++++++------------- 1 file changed, 34 insertions(+), 27 deletions(-) diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index 480d2353..b821b5f5 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -1,28 +1,35 @@ -name: Docker Build/Publish Image -on: - push: - branches: [ master ] -jobs: - build: - runs-on: ubuntu-18.04 - env: - DOCKER_IMAGE: kshfse/dashy - DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} - DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} - TARGETPLATFORM: linux/arm/v7 - steps: - - name: Checkout the code - uses: actions/checkout@v1 - - name: Set up Docker Buildx - uses: crazy-max/ghaction-docker-buildx@v1 - with: - version: latest - - name: Docker Login - if: success() - run: | - echo "${DOCKER_PASSWORD}" | docker login --username "${DOCKER_USERNAME}" --password-stdin - - name: Run Buildx (push image) - if: success() - run: | - docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v7 --tag kshfse/dashy:latest --file ./docker/Dockerfile-multi-arch --output type=image,push=true . +name: Build Multiplatform Image +on: + push: + branches: + - 'master' + +jobs: + docker: + runs-on: ubuntu-latest + steps: + - + 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: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + - + name: Build and push + uses: docker/build-push-action@v2 + with: + context: . + dockerfile: ./docker/Dockerfile-multi-arch + platforms: linux/amd64,linux/arm64,linux/arm/v7 + push: true + tags: ${{ secrets.DOCKER_REPO }}:latest From 71325c7f3ce1eafbcbc7b88baa621378eecb3fe3 Mon Sep 17 00:00:00 2001 From: Alicia Sykes Date: Sun, 23 Jan 2022 13:50:19 +0000 Subject: [PATCH 10/10] :whale: Attempts new multi-arch Docker action --- .github/workflows/docker-image.yml | 95 +++++++++++++++++++++--------- 1 file changed, 68 insertions(+), 27 deletions(-) diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index b821b5f5..5583f9b8 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -1,35 +1,76 @@ -name: Build Multiplatform Image +name: 🐳 Build + Publish Multi-Platform Image on: push: - branches: - - 'master' + branches: ['master'] + tags: [v*] + +env: + DH_IMAGE: ${{ secrets.DOCKER_REPO }} + GH_IMAGE: ${{ github.repository_owner }}/{{ github.event.repository.name }} jobs: docker: runs-on: ubuntu-latest + permissions: { contents: read, packages: write } + if: "!contains(github.event.head_commit.message, '[ci-skip]')" + steps: - - - 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: - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_PASSWORD }} - - - name: Build and push - uses: docker/build-push-action@v2 - with: - context: . - dockerfile: ./docker/Dockerfile-multi-arch - platforms: linux/amd64,linux/arm64,linux/arm/v7 - push: true - tags: ${{ secrets.DOCKER_REPO }}:latest + - name: 🛎️ Checkout Repo + uses: actions/checkout@v2 + + - name: 🔖 Get App Version + uses: tyankatsu0105/read-package-version-actions@v1 + id: package-version + + + - name: 🗂️ Make Docker Meta + id: meta + uses: docker/metadata-action@v3 + with: + images: | + ${{ env.DH_IMAGE }} + ghcr.io/${{ env.GH_IMAGE }} + tags: | + type=ref,event=tag,suffix={{tag}} + type=semver,pattern={{raw}},value=${{ steps.package-version.outputs.version }},prefix=release- + labels: | + maintainer=Lissy93 + org.opencontainers.image.title=Dashy + org.opencontainers.image.description=A self-hosted startpage for your server + org.opencontainers.image.documentation=https://dashy.to/docs + org.opencontainers.image.authors=Alicia Sykes + org.opencontainers.image.licenses=MIT + + - 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: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: 🔑 Login to GitHub Container Registry + uses: docker/login-action@v1 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: ⚒️ Build and push + uses: docker/build-push-action@v2 + with: + context: . + dockerfile: ./docker/Dockerfile-multi-arch + platforms: linux/amd64,linux/arm64,linux/arm/v7 + push: true + tags: | + ${{ env.DH_IMAGE }}:latest + ${{ env.DH_IMAGE }}:${{ steps.package-version.outputs.version }} + ${{ env.GH_IMAGE }}:latest + ${{ env.GH_IMAGE }}:${{ steps.package-version.outputs.version }} + \ No newline at end of file