Skip to content

A one-of-a-kind resume builder that keeps your privacy in mind. Completely secure, customizable, portable, open-source and free forever. Try it out today!

create new github actions workflow "Build and Push Multi-Arch Docker Images using Manifest"

Amruth Pillaid4a3cec3c286
diff --git a/.github/workflows/docker-manifest-build-publish.yml b/.github/workflows/docker-manifest-build-publish.yml
new file mode 100644
index 000000000..87d416b3c
--- /dev/null
+++ b/.github/workflows/docker-manifest-build-publish.yml
@@ -0,0 +1,126 @@
+name: Build and Push Multi-Arch Docker Images using Manifest
+
+on:
+ workflow_dispatch:
+
+env:
+ REGISTRY_IMAGE: amruthpillai/reactive-resume
+
+jobs:
+ build:
+ name: Build and Push Images
+ runs-on: ubuntu-latest
+
+ strategy:
+ fail-fast: false
+ matrix:
+ image:
+ - client
+ - server
+ platform:
+ - linux/amd64
+ - linux/arm64
+
+ steps:
+ - name: Checkout the repository
+ uses: actions/[email protected]
+
+ - id: version
+ name: Retrieve version from package.json
+ uses: martinbeentjes/[email protected]
+
+ - name: Set up QEMU
+ uses: docker/[email protected]
+ with:
+ platforms: ${{ matrix.platform }}
+
+ - name: Set up Docker Buildx
+ uses: docker/[email protected]
+
+ - name: Login to Docker Hub
+ uses: docker/[email protected]
+ with:
+ username: ${{ secrets.DOCKER_USERNAME }}
+ password: ${{ secrets.DOCKER_PASSWORD }}
+
+ - name: Login to GitHub Container Registry
+ uses: docker/[email protected]
+ with:
+ registry: ghcr.io
+ username: $GITHUB_REPOSITORY_OWNER
+ password: ${{ secrets.GH_TOKEN }}
+
+ - name: Build and Push by Digest
+ id: build
+ uses: docker/[email protected]
+ with:
+ context: .
+ platforms: ${{ matrix.platform }}
+ file: ${{ matrix.image }}/Dockerfile
+ labels: |
+ ${{ matrix.image }}-latest
+ ${{ matrix.image }}-${{ steps.version.outputs.current-version }}
+ outputs: type=image,name=${{ env.REGISTRY_IMAGE }},push-by-digest=true,name-canonical=true,push=true
+ build-args: |
+ TURBO_TOKEN=${{ secrets.TURBO_TOKEN }}
+
+ - name: Export Digests
+ run: |
+ mkdir -p /tmp/digests
+ digest="${{ steps.build.outputs.digest }}"
+ touch "/tmp/digests/${digest#sha256:}"
+
+ - name: Upload Digests
+ uses: actions/[email protected]
+ with:
+ name: digests
+ path: /tmp/digests/*
+ if-no-files-found: error
+ retention-days: 1
+
+ publish:
+ name: Publish Manifest
+ runs-on: ubuntu-latest
+
+ needs:
+ - build
+
+ steps:
+ - name: Checkout the repository
+ uses: actions/[email protected]
+
+ - id: version
+ name: Retrieve version from package.json
+ uses: martinbeentjes/[email protected]
+
+ - name: Download Digests
+ uses: actions/[email protected]
+ with:
+ name: digests
+ path: /tmp/digests
+
+ - name: Set up Docker Buildx
+ uses: docker/[email protected]
+
+ - name: Login to Docker Hub
+ uses: docker/[email protected]
+ with:
+ username: ${{ secrets.DOCKER_USERNAME }}
+ password: ${{ secrets.DOCKER_PASSWORD }}
+
+ - name: Login to GitHub Container Registry
+ uses: docker/[email protected]
+ with:
+ registry: ghcr.io
+ username: $GITHUB_REPOSITORY_OWNER
+ password: ${{ secrets.GH_TOKEN }}
+
+ - name: Create Docker Manifest and Publish
+ working-directory: /tmp/digests
+ run: |
+ docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
+ $(printf '${{ env.REGISTRY_IMAGE }}@sha256:%s ' *)
+
+ - name: Inspect Image
+ run: |
+ docker buildx imagetools inspect ${{ env.REGISTRY_IMAGE }}:${{ steps.version.outputs.current-version }}