From 5ea4b5f9727f6adf353fed90e355a3851508cc71 Mon Sep 17 00:00:00 2001
From: realkaranvir <113927390+realkaranvir@users.noreply.github.com>
Date: Sat, 7 Dec 2024 14:50:07 -0800
Subject: [PATCH 01/17] updated docker workflow to use multiplatform image
---
.github/workflows/docker-image.yml | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml
index 2457f3044..eb31c5224 100644
--- a/.github/workflows/docker-image.yml
+++ b/.github/workflows/docker-image.yml
@@ -3,10 +3,10 @@ name: Docker Image CI/CD
on:
push:
branches:
- - master
+ - karan
pull_request:
branches:
- - master
+ - karan
jobs:
push_to_registry:
@@ -50,6 +50,7 @@ jobs:
uses: docker/build-push-action@v6
with:
context: .
+ platform: linux/amd64,linux/arm64
cache-from: type=gha
cache-to: type=gha,mode=max
push: ${{ github.event_name != 'pull_request' }}
From 70bb4d9c4bf8d63d071c8f3f833f2cd75d5cf1bb Mon Sep 17 00:00:00 2001
From: realkaranvir <113927390+realkaranvir@users.noreply.github.com>
Date: Sat, 7 Dec 2024 14:52:20 -0800
Subject: [PATCH 02/17] fixed typo
---
.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 eb31c5224..10733378b 100644
--- a/.github/workflows/docker-image.yml
+++ b/.github/workflows/docker-image.yml
@@ -50,7 +50,7 @@ jobs:
uses: docker/build-push-action@v6
with:
context: .
- platform: linux/amd64,linux/arm64
+ platforms: linux/amd64,linux/arm64
cache-from: type=gha
cache-to: type=gha,mode=max
push: ${{ github.event_name != 'pull_request' }}
From 382dbf40e6307aadcc11ebd7c46a33a6d2af8219 Mon Sep 17 00:00:00 2001
From: realkaranvir <113927390+realkaranvir@users.noreply.github.com>
Date: Sat, 7 Dec 2024 15:26:51 -0800
Subject: [PATCH 03/17] changed docker workflow to use multiple runners
---
.github/workflows/docker-image.yml | 9 ++++++---
docker-compose.yml | 2 +-
2 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml
index 10733378b..c928b5520 100644
--- a/.github/workflows/docker-image.yml
+++ b/.github/workflows/docker-image.yml
@@ -9,10 +9,13 @@ on:
- karan
jobs:
- push_to_registry:
+ build_and_push_docker_image:
name: Push Docker Image to Docker Hub
- if: github.event_name == 'push'
runs-on: ubuntu-latest
+ strategy:
+ matrix:
+ platform: [linux/amd64, linux/arm64]
+
steps:
- name: Checkout Repository
uses: actions/checkout@v4
@@ -50,7 +53,7 @@ jobs:
uses: docker/build-push-action@v6
with:
context: .
- platforms: linux/amd64,linux/arm64
+ platforms: ${{ matrix.platform }}
cache-from: type=gha
cache-to: type=gha,mode=max
push: ${{ github.event_name != 'pull_request' }}
diff --git a/docker-compose.yml b/docker-compose.yml
index be16c8367..9dbde9ec3 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -24,7 +24,7 @@ services:
retries: 10
femr:
- build: .
+ image: teamfemrdev/teamfemr
links:
- db:mysql
depends_on:
From b7b7acfa645e23b55a37abaec74ea555434116e3 Mon Sep 17 00:00:00 2001
From: realkaranvir <113927390+realkaranvir@users.noreply.github.com>
Date: Sat, 7 Dec 2024 15:41:16 -0800
Subject: [PATCH 04/17] testing old workflow
---
.github/workflows/docker-image.yml | 50 +++++++-----------------
app/femr/ui/views/admin/index.scala.html | 2 +-
2 files changed, 15 insertions(+), 37 deletions(-)
diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml
index c928b5520..283ee7bde 100644
--- a/.github/workflows/docker-image.yml
+++ b/.github/workflows/docker-image.yml
@@ -9,52 +9,30 @@ on:
- karan
jobs:
- build_and_push_docker_image:
+ push_to_registry:
name: Push Docker Image to Docker Hub
+ if: github.event_name == 'push'
runs-on: ubuntu-latest
- strategy:
- matrix:
- platform: [linux/amd64, linux/arm64]
-
steps:
- - name: Checkout Repository
+ - name: Check Repository
uses: actions/checkout@v4
-
- name: Login to Docker Registry
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_HUB_EMAIL }}
password: ${{ secrets.DOCKER_HUB_PASSWORD }}
-
- - name: Set up Docker Buildx
- uses: docker/setup-buildx-action@v3
-
- - name: Cache Docker Dependencies
- uses: actions/cache@v3
- with:
- path: |
- root/.ivy2
- root/.sbt
- key: sbt-${{ runner.os }}-${{ hashFiles('**/build.sbt', '**/project/*.sbt') }}
- restore-keys: |
- sbt-${{ runner.os }}-
-
- - name: Inject sbt cache into Docker
- uses: reproducible-containers/buildkit-cache-dance@v3.1.0
- with:
- cache-map: |
- {
- "root/.ivy2": "/root/.ivy2",
- "root/.sbt": "/root/.sbt"
- }
- skip-extraction: ${{ steps.cache.outputs.cache-hit }}
-
- name: Build and Push Docker Image to Registry
- uses: docker/build-push-action@v6
+ uses: docker/build-push-action@v5
with:
context: .
- platforms: ${{ matrix.platform }}
- cache-from: type=gha
- cache-to: type=gha,mode=max
- push: ${{ github.event_name != 'pull_request' }}
+ push: true
tags: teamfemrdev/teamfemr:latest
+ build:
+ name: Build Docker Image on Pull Request
+ if: github.event_name == 'pull_request'
+ runs-on: ubuntu-latest
+ steps:
+ - name: Check Repository
+ uses: actions/checkout@v4
+ - name: Build the Docker Image
+ run: docker build . --file Dockerfile --tag femr-femr:latest
diff --git a/app/femr/ui/views/admin/index.scala.html b/app/femr/ui/views/admin/index.scala.html
index f02105132..cdf57abfa 100644
--- a/app/femr/ui/views/admin/index.scala.html
+++ b/app/femr/ui/views/admin/index.scala.html
@@ -27,5 +27,5 @@
@admin("Admin", currentUser, assets = assets) {
-
Welcome, Administrator. Choose an option to get started.
+ Welcome, bruh. Choose an option to get started.
}
From 56345596a5b898da8949003e0f9a39f857945f98 Mon Sep 17 00:00:00 2001
From: realkaranvir <113927390+realkaranvir@users.noreply.github.com>
Date: Sat, 7 Dec 2024 16:41:27 -0800
Subject: [PATCH 05/17] switched to build-push-action v5
---
.github/workflows/docker-image.yml | 44 +++++++++++++++++-------
app/femr/ui/views/admin/index.scala.html | 2 +-
2 files changed, 32 insertions(+), 14 deletions(-)
diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml
index 283ee7bde..1f0c319b1 100644
--- a/.github/workflows/docker-image.yml
+++ b/.github/workflows/docker-image.yml
@@ -9,30 +9,48 @@ on:
- karan
jobs:
- push_to_registry:
+ build_and_push_docker_image:
name: Push Docker Image to Docker Hub
- if: github.event_name == 'push'
runs-on: ubuntu-latest
+
steps:
- - name: Check Repository
+ - name: Checkout Repository
uses: actions/checkout@v4
+
- name: Login to Docker Registry
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_HUB_EMAIL }}
password: ${{ secrets.DOCKER_HUB_PASSWORD }}
+
+ - name: Set up Docker Buildx
+ uses: docker/setup-buildx-action@v3
+
+ - name: Cache Docker Dependencies
+ uses: actions/cache@v3
+ with:
+ path: |
+ root/.ivy2
+ root/.sbt
+ key: sbt-${{ runner.os }}-${{ hashFiles('**/build.sbt', '**/project/*.sbt') }}
+ restore-keys: |
+ sbt-${{ runner.os }}-
+
+ - name: Inject sbt cache into Docker
+ uses: reproducible-containers/buildkit-cache-dance@v3.1.0
+ with:
+ cache-map: |
+ {
+ "root/.ivy2": "/root/.ivy2",
+ "root/.sbt": "/root/.sbt"
+ }
+ skip-extraction: ${{ steps.cache.outputs.cache-hit }}
+
- name: Build and Push Docker Image to Registry
uses: docker/build-push-action@v5
with:
context: .
- push: true
+ cache-from: type=gha
+ cache-to: type=gha,mode=max
+ push: ${{ github.event_name != 'pull_request' }}
tags: teamfemrdev/teamfemr:latest
- build:
- name: Build Docker Image on Pull Request
- if: github.event_name == 'pull_request'
- runs-on: ubuntu-latest
- steps:
- - name: Check Repository
- uses: actions/checkout@v4
- - name: Build the Docker Image
- run: docker build . --file Dockerfile --tag femr-femr:latest
diff --git a/app/femr/ui/views/admin/index.scala.html b/app/femr/ui/views/admin/index.scala.html
index cdf57abfa..f02105132 100644
--- a/app/femr/ui/views/admin/index.scala.html
+++ b/app/femr/ui/views/admin/index.scala.html
@@ -27,5 +27,5 @@
@admin("Admin", currentUser, assets = assets) {
- Welcome, bruh. Choose an option to get started.
+ Welcome, Administrator. Choose an option to get started.
}
From 8a7e7515a045f3cb0e5dc357c2f0220b8a1c1928 Mon Sep 17 00:00:00 2001
From: realkaranvir <113927390+realkaranvir@users.noreply.github.com>
Date: Sat, 7 Dec 2024 16:58:20 -0800
Subject: [PATCH 06/17] attempting to create different caches for each platform
---
.github/workflows/docker-image.yml | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml
index 1f0c319b1..9f163a79a 100644
--- a/.github/workflows/docker-image.yml
+++ b/.github/workflows/docker-image.yml
@@ -12,6 +12,9 @@ jobs:
build_and_push_docker_image:
name: Push Docker Image to Docker Hub
runs-on: ubuntu-latest
+ strategy:
+ matrix:
+ platform: [linux/amd64, linux/arm64]
steps:
- name: Checkout Repository
@@ -32,9 +35,9 @@ jobs:
path: |
root/.ivy2
root/.sbt
- key: sbt-${{ runner.os }}-${{ hashFiles('**/build.sbt', '**/project/*.sbt') }}
+ key: sbt-${{ runner.os }}-${{ matrix.platform }}-${{ hashFiles('**/build.sbt', '**/project/*.sbt') }}
restore-keys: |
- sbt-${{ runner.os }}-
+ sbt-${{ runner.os }}-${{ matrix.platform }}
- name: Inject sbt cache into Docker
uses: reproducible-containers/buildkit-cache-dance@v3.1.0
@@ -50,6 +53,7 @@ jobs:
uses: docker/build-push-action@v5
with:
context: .
+ platforms: ${{ matrix.platform }}
cache-from: type=gha
cache-to: type=gha,mode=max
push: ${{ github.event_name != 'pull_request' }}
From 954b77401edd11e5498ec1c396386b6e49dce9a3 Mon Sep 17 00:00:00 2001
From: realkaranvir <113927390+realkaranvir@users.noreply.github.com>
Date: Sat, 7 Dec 2024 17:35:51 -0800
Subject: [PATCH 07/17] changed runner architecture
---
.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 9f163a79a..be8daa4ab 100644
--- a/.github/workflows/docker-image.yml
+++ b/.github/workflows/docker-image.yml
@@ -11,10 +11,10 @@ on:
jobs:
build_and_push_docker_image:
name: Push Docker Image to Docker Hub
- runs-on: ubuntu-latest
strategy:
matrix:
platform: [linux/amd64, linux/arm64]
+ runs-on: ${{ matrix.platform == 'linux/amd64' && 'ubuntu-latest' || 'ubuntu-20.04' }}
steps:
- name: Checkout Repository
From 2fe519633a47234caef4021bc7ea06b4a8a6a56b Mon Sep 17 00:00:00 2001
From: realkaranvir <113927390+realkaranvir@users.noreply.github.com>
Date: Sat, 7 Dec 2024 17:42:07 -0800
Subject: [PATCH 08/17] switched to dedicated arm64 runner
---
.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 be8daa4ab..fd74d50bb 100644
--- a/.github/workflows/docker-image.yml
+++ b/.github/workflows/docker-image.yml
@@ -14,7 +14,7 @@ jobs:
strategy:
matrix:
platform: [linux/amd64, linux/arm64]
- runs-on: ${{ matrix.platform == 'linux/amd64' && 'ubuntu-latest' || 'ubuntu-20.04' }}
+ runs-on: ${{ matrix.platform == 'linux/amd64' && 'ubuntu-latest' || 'macos-latest-xlarge,' }}
steps:
- name: Checkout Repository
From 86da202bbbcd28fad7256ec2bad3bd8fe09b2918 Mon Sep 17 00:00:00 2001
From: realkaranvir <113927390+realkaranvir@users.noreply.github.com>
Date: Sat, 7 Dec 2024 17:50:11 -0800
Subject: [PATCH 09/17] changed to macos runner
---
.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 fd74d50bb..113487b85 100644
--- a/.github/workflows/docker-image.yml
+++ b/.github/workflows/docker-image.yml
@@ -14,7 +14,7 @@ jobs:
strategy:
matrix:
platform: [linux/amd64, linux/arm64]
- runs-on: ${{ matrix.platform == 'linux/amd64' && 'ubuntu-latest' || 'macos-latest-xlarge,' }}
+ runs-on: ${{ matrix.platform == 'linux/amd64' && 'ubuntu-latest' || 'macos-latest' }}
steps:
- name: Checkout Repository
From 750eec5bc0d336d08f8346fefcb2ba89d82d738f Mon Sep 17 00:00:00 2001
From: realkaranvir <113927390+realkaranvir@users.noreply.github.com>
Date: Sat, 7 Dec 2024 17:52:40 -0800
Subject: [PATCH 10/17] set platform just to amd64
---
.github/workflows/docker-image.yml | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml
index 113487b85..92fdb7ba9 100644
--- a/.github/workflows/docker-image.yml
+++ b/.github/workflows/docker-image.yml
@@ -11,10 +11,7 @@ on:
jobs:
build_and_push_docker_image:
name: Push Docker Image to Docker Hub
- strategy:
- matrix:
- platform: [linux/amd64, linux/arm64]
- runs-on: ${{ matrix.platform == 'linux/amd64' && 'ubuntu-latest' || 'macos-latest' }}
+ runs-on: ubuntu-latest
steps:
- name: Checkout Repository
@@ -35,9 +32,9 @@ jobs:
path: |
root/.ivy2
root/.sbt
- key: sbt-${{ runner.os }}-${{ matrix.platform }}-${{ hashFiles('**/build.sbt', '**/project/*.sbt') }}
+ key: sbt-${{ runner.os }}-${{ hashFiles('**/build.sbt', '**/project/*.sbt') }}
restore-keys: |
- sbt-${{ runner.os }}-${{ matrix.platform }}
+ sbt-${{ runner.os }}-
- name: Inject sbt cache into Docker
uses: reproducible-containers/buildkit-cache-dance@v3.1.0
@@ -53,7 +50,7 @@ jobs:
uses: docker/build-push-action@v5
with:
context: .
- platforms: ${{ matrix.platform }}
+ platforms: linux/amd64
cache-from: type=gha
cache-to: type=gha,mode=max
push: ${{ github.event_name != 'pull_request' }}
From 358d2dcc60feaf844ea243608434285ceaa5dc70 Mon Sep 17 00:00:00 2001
From: realkaranvir <113927390+realkaranvir@users.noreply.github.com>
Date: Sat, 7 Dec 2024 19:55:18 -0800
Subject: [PATCH 11/17] updated workflow
---
.github/workflows/docker-image.yml | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml
index 92fdb7ba9..54599789a 100644
--- a/.github/workflows/docker-image.yml
+++ b/.github/workflows/docker-image.yml
@@ -12,6 +12,9 @@ jobs:
build_and_push_docker_image:
name: Push Docker Image to Docker Hub
runs-on: ubuntu-latest
+ strategy:
+ matrix:
+ platform: [linux/amd64, linux/arm64]
steps:
- name: Checkout Repository
@@ -23,6 +26,9 @@ jobs:
username: ${{ secrets.DOCKER_HUB_EMAIL }}
password: ${{ secrets.DOCKER_HUB_PASSWORD }}
+ - name: Set up QEMU
+ uses: docker/setup-qemu-action@v3
+
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
@@ -32,9 +38,9 @@ jobs:
path: |
root/.ivy2
root/.sbt
- key: sbt-${{ runner.os }}-${{ hashFiles('**/build.sbt', '**/project/*.sbt') }}
+ key: sbt-${{ runner.os }}-${{ matrix.platform }}-${{ hashFiles('**/build.sbt', '**/project/*.sbt') }}
restore-keys: |
- sbt-${{ runner.os }}-
+ sbt-${{ runner.os }}-${{ matrix.platform }}
- name: Inject sbt cache into Docker
uses: reproducible-containers/buildkit-cache-dance@v3.1.0
@@ -50,7 +56,7 @@ jobs:
uses: docker/build-push-action@v5
with:
context: .
- platforms: linux/amd64
+ platforms: linux/amd64, linux/arm64
cache-from: type=gha
cache-to: type=gha,mode=max
push: ${{ github.event_name != 'pull_request' }}
From 50770c8c91fccc03a391cd8c6fc8a741be3a7a2c Mon Sep 17 00:00:00 2001
From: realkaranvir <113927390+realkaranvir@users.noreply.github.com>
Date: Sat, 7 Dec 2024 20:01:05 -0800
Subject: [PATCH 12/17] updated workflow
---
.github/workflows/docker-image.yml | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml
index 54599789a..c6f3598f4 100644
--- a/.github/workflows/docker-image.yml
+++ b/.github/workflows/docker-image.yml
@@ -12,9 +12,6 @@ jobs:
build_and_push_docker_image:
name: Push Docker Image to Docker Hub
runs-on: ubuntu-latest
- strategy:
- matrix:
- platform: [linux/amd64, linux/arm64]
steps:
- name: Checkout Repository
@@ -38,9 +35,9 @@ jobs:
path: |
root/.ivy2
root/.sbt
- key: sbt-${{ runner.os }}-${{ matrix.platform }}-${{ hashFiles('**/build.sbt', '**/project/*.sbt') }}
+ key: sbt-${{ runner.os }}-${{ hashFiles('**/build.sbt', '**/project/*.sbt') }}
restore-keys: |
- sbt-${{ runner.os }}-${{ matrix.platform }}
+ sbt-${{ runner.os }}
- name: Inject sbt cache into Docker
uses: reproducible-containers/buildkit-cache-dance@v3.1.0
@@ -56,7 +53,6 @@ jobs:
uses: docker/build-push-action@v5
with:
context: .
- platforms: linux/amd64, linux/arm64
cache-from: type=gha
cache-to: type=gha,mode=max
push: ${{ github.event_name != 'pull_request' }}
From f410d03db60ee8adad3569e407ae37d266069125 Mon Sep 17 00:00:00 2001
From: realkaranvir <113927390+realkaranvir@users.noreply.github.com>
Date: Sat, 7 Dec 2024 20:25:00 -0800
Subject: [PATCH 13/17] docker workflow creates amd64 and arm64 architectures
only on push
---
.github/workflows/docker-image.yml | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml
index c6f3598f4..ca6881c62 100644
--- a/.github/workflows/docker-image.yml
+++ b/.github/workflows/docker-image.yml
@@ -50,9 +50,10 @@ jobs:
skip-extraction: ${{ steps.cache.outputs.cache-hit }}
- name: Build and Push Docker Image to Registry
- uses: docker/build-push-action@v5
+ uses: docker/build-push-action@v6
with:
context: .
+ platforms: ${{ github.event_name == 'push' && 'linux/amd64,linux/arm64' || 'linux/amd64' }}
cache-from: type=gha
cache-to: type=gha,mode=max
push: ${{ github.event_name != 'pull_request' }}
From 0093bff6c654735e32d0d623a63f973dc239b86c Mon Sep 17 00:00:00 2001
From: realkaranvir <113927390+realkaranvir@users.noreply.github.com>
Date: Sat, 7 Dec 2024 20:59:47 -0800
Subject: [PATCH 14/17] updated workflow to use simultaneous runners
---
.github/workflows/docker-image.yml | 66 ++++++++++++++++++++++++++----
1 file changed, 58 insertions(+), 8 deletions(-)
diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml
index ca6881c62..3e9cccd85 100644
--- a/.github/workflows/docker-image.yml
+++ b/.github/workflows/docker-image.yml
@@ -9,9 +9,10 @@ on:
- karan
jobs:
- build_and_push_docker_image:
- name: Push Docker Image to Docker Hub
+ build_image_pr_test:
+ name: Build Image Test For PR
runs-on: ubuntu-latest
+ if: github.event_name == 'pull_request'
steps:
- name: Checkout Repository
@@ -23,8 +24,57 @@ jobs:
username: ${{ secrets.DOCKER_HUB_EMAIL }}
password: ${{ secrets.DOCKER_HUB_PASSWORD }}
- - name: Set up QEMU
- uses: docker/setup-qemu-action@v3
+ - name: Set up Docker Buildx
+ uses: docker/setup-buildx-action@v3
+
+ - name: Cache Docker Dependencies
+ uses: actions/cache@v3
+ with:
+ path: |
+ root/.ivy2
+ root/.sbt
+ key: sbt-${{ runner.os }}-linux/amd64-${{ hashFiles('**/build.sbt', '**/project/*.sbt') }}
+ restore-keys: |
+ sbt-${{ runner.os }}-linux/amd64
+
+ - name: Inject sbt cache into Docker
+ uses: reproducible-containers/buildkit-cache-dance@v3.1.0
+ with:
+ cache-map: |
+ {
+ "root/.ivy2": "/root/.ivy2",
+ "root/.sbt": "/root/.sbt"
+ }
+ skip-extraction: ${{ steps.cache.outputs.cache-hit }}
+
+ - name: Build and Push Docker Image to Registry
+ uses: docker/build-push-action@v6
+ with:
+ context: .
+ platforms: linux/amd64
+ cache-from: type=gha
+ cache-to: type=gha,mode=max
+ push: false
+ tags: teamfemrdev/teamfemr:latest
+
+ build_and_push_image:
+ name: Push Docker Image to Docker Hub
+ runs-on: ubuntu-latest
+ if: github.event_name == 'push'
+ strategy:
+ fail-fast: true
+ matrix:
+ platform: [linux/amd64, linux/arm64]
+
+ steps:
+ - name: Checkout Repository
+ uses: actions/checkout@v4
+
+ - name: Login to Docker Registry
+ uses: docker/login-action@v3
+ with:
+ username: ${{ secrets.DOCKER_HUB_EMAIL }}
+ password: ${{ secrets.DOCKER_HUB_PASSWORD }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
@@ -35,9 +85,9 @@ jobs:
path: |
root/.ivy2
root/.sbt
- key: sbt-${{ runner.os }}-${{ hashFiles('**/build.sbt', '**/project/*.sbt') }}
+ key: sbt-${{ runner.os }}-${{matrix.platform}}-${{ hashFiles('**/build.sbt', '**/project/*.sbt') }}
restore-keys: |
- sbt-${{ runner.os }}
+ sbt-${{ runner.os }}-${{matrix.platform}}
- name: Inject sbt cache into Docker
uses: reproducible-containers/buildkit-cache-dance@v3.1.0
@@ -53,8 +103,8 @@ jobs:
uses: docker/build-push-action@v6
with:
context: .
- platforms: ${{ github.event_name == 'push' && 'linux/amd64,linux/arm64' || 'linux/amd64' }}
+ platforms: ${{ matrix.platform }}
cache-from: type=gha
cache-to: type=gha,mode=max
- push: ${{ github.event_name != 'pull_request' }}
+ push: true
tags: teamfemrdev/teamfemr:latest
From a7d3fa8b368ecb367da14a2ad60bd1cfbe561ea3 Mon Sep 17 00:00:00 2001
From: realkaranvir <113927390+realkaranvir@users.noreply.github.com>
Date: Sat, 7 Dec 2024 21:20:01 -0800
Subject: [PATCH 15/17] changed branches to master
---
.github/workflows/docker-image.yml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml
index 3e9cccd85..4b9ff7dd6 100644
--- a/.github/workflows/docker-image.yml
+++ b/.github/workflows/docker-image.yml
@@ -3,10 +3,10 @@ name: Docker Image CI/CD
on:
push:
branches:
- - karan
+ - master
pull_request:
branches:
- - karan
+ - master
jobs:
build_image_pr_test:
From fe771076a8829bd15ef59a45cde962b4647d3bff Mon Sep 17 00:00:00 2001
From: realkaranvir <113927390+realkaranvir@users.noreply.github.com>
Date: Sun, 8 Dec 2024 11:41:22 -0800
Subject: [PATCH 16/17] added comments and updated naming
---
.github/workflows/docker-image.yml | 21 ++++++++++++++++-----
1 file changed, 16 insertions(+), 5 deletions(-)
diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml
index 4b9ff7dd6..f05d3d09e 100644
--- a/.github/workflows/docker-image.yml
+++ b/.github/workflows/docker-image.yml
@@ -10,9 +10,16 @@ on:
jobs:
build_image_pr_test:
+ # Only runs build on PRs.
+ # Only does linux/amd64 build do to speed. Once Github adds more ARM runners, we can add more platforms.
+
name: Build Image Test For PR
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
+ strategy:
+ fail-fast: true
+ matrix:
+ platform: [linux/amd64] # Add linux/arm64 when more runners are available.
steps:
- name: Checkout Repository
@@ -27,16 +34,18 @@ jobs:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
+ # Caches dependencies separately for each platform.
- name: Cache Docker Dependencies
uses: actions/cache@v3
with:
path: |
root/.ivy2
root/.sbt
- key: sbt-${{ runner.os }}-linux/amd64-${{ hashFiles('**/build.sbt', '**/project/*.sbt') }}
+ key: sbt-${{ runner.os }}-${{matrix.platform}}-${{ hashFiles('**/build.sbt', '**/project/*.sbt') }}
restore-keys: |
- sbt-${{ runner.os }}-linux/amd64
+ sbt-${{ runner.os }}-${{matrix.platform}}
+ # Injects the cache into the Docker build. Path is based on cache path in Dockerfile.
- name: Inject sbt cache into Docker
uses: reproducible-containers/buildkit-cache-dance@v3.1.0
with:
@@ -47,14 +56,14 @@ jobs:
}
skip-extraction: ${{ steps.cache.outputs.cache-hit }}
- - name: Build and Push Docker Image to Registry
+ - name: Build Docker Image
uses: docker/build-push-action@v6
with:
context: .
- platforms: linux/amd64
+ platforms: ${{ matrix.platform }}
cache-from: type=gha
cache-to: type=gha,mode=max
- push: false
+ push: false # Doesn't push to dockerhub on PRs.
tags: teamfemrdev/teamfemr:latest
build_and_push_image:
@@ -79,6 +88,7 @@ jobs:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
+ # Caches dependencies separately for each platform.
- name: Cache Docker Dependencies
uses: actions/cache@v3
with:
@@ -89,6 +99,7 @@ jobs:
restore-keys: |
sbt-${{ runner.os }}-${{matrix.platform}}
+ # Injects the cache into the Docker build. Path is based on cache path in Dockerfile.
- name: Inject sbt cache into Docker
uses: reproducible-containers/buildkit-cache-dance@v3.1.0
with:
From cd6d7376d0e03a7459d01d98845543618a215a54 Mon Sep 17 00:00:00 2001
From: Karan Sandhu <113927390+realkaranvir@users.noreply.github.com>
Date: Sun, 8 Dec 2024 11:54:20 -0800
Subject: [PATCH 17/17] Update docker-compose.yml
reverted docker compose to build local image
---
docker-compose.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/docker-compose.yml b/docker-compose.yml
index 9dbde9ec3..be16c8367 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -24,7 +24,7 @@ services:
retries: 10
femr:
- image: teamfemrdev/teamfemr
+ build: .
links:
- db:mysql
depends_on: