From e3ee5dcc9184cbf673ffd34859c7f492dda4ec8d Mon Sep 17 00:00:00 2001
From: Sebastien Baizet <sebastien.baizet@gmail.com>
Date: Mon, 7 Oct 2024 10:08:23 +0200
Subject: [PATCH 1/3] ci: add github action triggered manually to generate
 docker image

---
 .github/workflows/docker-release.yml | 68 ++++++++++++++++++++++++++++
 1 file changed, 68 insertions(+)
 create mode 100644 .github/workflows/docker-release.yml

diff --git a/.github/workflows/docker-release.yml b/.github/workflows/docker-release.yml
new file mode 100644
index 00000000..bbaa343e
--- /dev/null
+++ b/.github/workflows/docker-release.yml
@@ -0,0 +1,68 @@
+name: Build and publish scroll-alpine image
+
+on:
+  workflow_dispatch:
+
+jobs:
+  build:
+    name: Clone, Build, Publish
+    runs-on: ubuntu-latest
+    steps:
+
+      - name: Check out repository
+        uses: actions/checkout@v3
+        with:
+          submodules: true
+
+      - name: Update submodules recursively
+        run: git submodule update --init --recursive
+
+      - name: Set up QEMU
+        uses: docker/setup-qemu-action@v2
+
+      - name: Setup Node.js environment
+        uses: actions/setup-node@v3
+        with:
+          node-version: '21'
+
+      - name: Install dependencies
+        run: npm install
+
+      - name: Set up Docker Buildx
+        uses: docker/setup-buildx-action@v2
+
+      - name: Login to Dockerhub
+        uses: docker/login-action@v2
+        with:
+          username: ${{ secrets.DOCKERHUB_USERNAME }}
+          password: ${{ secrets.DOCKERHUB_TOKEN }}
+
+      - name: Build deploy image
+        id: build_deploy_image
+        env:
+          REGISTRY: ${{ steps.login-ecr.outputs.registry }}
+          REPOSITORY: scrolltech/scroll-stack-contracts
+        uses: docker/build-push-action@v3
+        with:
+          platforms: linux/amd64,linux/arm64
+          push: true
+          context: .
+          file: docker/Dockerfile.deploy
+          tags: |
+            ${{ env.REPOSITORY }}:deploy-${{ github.ref_name }}
+            ${{ env.REPOSITORY }}:latest
+
+      - name: Build gen image
+        id: build_gen_image
+        env:
+          REGISTRY: ${{ steps.login-ecr.outputs.registry }}
+          REPOSITORY: scrolltech/scroll-stack-contracts
+        uses: docker/build-push-action@v3
+        with:
+          platforms: linux/amd64,linux/arm64
+          push: true
+          context: .
+          file: docker/Dockerfile.gen-configs
+          tags: |
+            ${{ env.REPOSITORY }}:gen-configs-${{ github.ref_name }}
+            ${{ env.REPOSITORY }}:latest

From 515e883c0c6ee4a378bd234d5c1d33c79fd01f44 Mon Sep 17 00:00:00 2001
From: Sebastien Baizet <sebastien.baizet@gmail.com>
Date: Fri, 11 Oct 2024 10:06:13 +0200
Subject: [PATCH 2/3] use commit sha instead of branch tag for image tagging

---
 .github/workflows/docker-release.yml | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/.github/workflows/docker-release.yml b/.github/workflows/docker-release.yml
index bbaa343e..db89f67c 100644
--- a/.github/workflows/docker-release.yml
+++ b/.github/workflows/docker-release.yml
@@ -1,4 +1,5 @@
 name: Build and publish scroll-alpine image
+# This workflow aims to build images from the feat-deterministic-deployment branch
 
 on:
   workflow_dispatch:
@@ -49,8 +50,7 @@ jobs:
           context: .
           file: docker/Dockerfile.deploy
           tags: |
-            ${{ env.REPOSITORY }}:deploy-${{ github.ref_name }}
-            ${{ env.REPOSITORY }}:latest
+            ${{ env.REPOSITORY }}:deploy-${{ github.sha }}
 
       - name: Build gen image
         id: build_gen_image
@@ -64,5 +64,4 @@ jobs:
           context: .
           file: docker/Dockerfile.gen-configs
           tags: |
-            ${{ env.REPOSITORY }}:gen-configs-${{ github.ref_name }}
-            ${{ env.REPOSITORY }}:latest
+            ${{ env.REPOSITORY }}:gen-configs-${{ github.sha }}

From 5bffe6df5c205f402cb0d8fec2bf144a4b661a4e Mon Sep 17 00:00:00 2001
From: Sebastien Baizet <sebastien.baizet@gmail.com>
Date: Fri, 11 Oct 2024 10:34:01 +0200
Subject: [PATCH 3/3] ci: remove REGISTRY env var

---
 .github/workflows/docker-release.yml | 2 --
 1 file changed, 2 deletions(-)

diff --git a/.github/workflows/docker-release.yml b/.github/workflows/docker-release.yml
index db89f67c..c16792ab 100644
--- a/.github/workflows/docker-release.yml
+++ b/.github/workflows/docker-release.yml
@@ -41,7 +41,6 @@ jobs:
       - name: Build deploy image
         id: build_deploy_image
         env:
-          REGISTRY: ${{ steps.login-ecr.outputs.registry }}
           REPOSITORY: scrolltech/scroll-stack-contracts
         uses: docker/build-push-action@v3
         with:
@@ -55,7 +54,6 @@ jobs:
       - name: Build gen image
         id: build_gen_image
         env:
-          REGISTRY: ${{ steps.login-ecr.outputs.registry }}
           REPOSITORY: scrolltech/scroll-stack-contracts
         uses: docker/build-push-action@v3
         with: