Use multi-stage builds to unzip and copy jars (#118)

* Use multi-stage builds to unzip and copy jars

* Change base docker iamge

* Fix mkdir command

* Revert mkdir concat

* Remove apt-get calls

* Revert local COPY change

* Use apk to install packages

* Revert to debian based image

* Fix copy location

* Merge mkdir commands

* Amended directories

* Remove libs based on platform

* Use uname -m to get current architecture

* Switch if statement to case statement to uname call

* Fix zip copy

* Add WORKDIR to improve readability, move removal of darwin dir out of case switches

* feat: change builder image to a more secure one

* feat: change builder and final image to eclipse-temurin 21-alpine

* feat: removed unnecessary slash

* feat: update dockerfile to avoid hardcoded version for jar files

* feat: allow more flexible name matching for jar files

* feat: use installDist in GHA job to avoid unzip

* feat: use installDist in GHA job to avoid unzip in transaction-exclusion-api

* feat: update manual image build for coordinator and tx-exclusion-api

* feat: revert setting ssl and gssEncMode in tx-exclusion-api integration test

---------

Co-authored-by: jonesho <jones.ho@consensys.net>
Co-authored-by: jonesho <81145364+jonesho@users.noreply.github.com>
This commit is contained in:
Bradley Bown
2024-12-02 18:43:24 +00:00
committed by GitHub
parent 7f83ea94cf
commit bca27b112f
4 changed files with 38 additions and 35 deletions

View File

@@ -76,7 +76,7 @@ jobs:
uses: gradle/actions/setup-gradle@v4
- name: Build dist
run: |
./gradlew coordinator:app:distZip --no-daemon
./gradlew coordinator:app:installDist --no-daemon
- name: Login to Docker Hub
if: ${{ env.DOCKERHUB_USERNAME != '' && env.DOCKERHUB_TOKEN != '' }}
uses: docker/login-action@v3
@@ -98,7 +98,7 @@ jobs:
if: ${{ env.PUSH_IMAGE == 'false' }}
with:
context: .
build-contexts: zip=./coordinator/app/build/distributions/
build-contexts: libs=./coordinator/app/build/install/coordinator/lib
file: ./coordinator/Dockerfile
platforms: linux/amd64
load: true
@@ -120,7 +120,7 @@ jobs:
if: ${{ env.PUSH_IMAGE == 'true' || github.event_name == 'workflow_dispatch' }}
with:
context: .
build-contexts: zip=./coordinator/app/build/distributions/
build-contexts: libs=./coordinator/app/build/install/coordinator/lib
file: ./coordinator/Dockerfile
platforms: linux/amd64,linux/arm64
push: true

View File

@@ -76,7 +76,7 @@ jobs:
uses: gradle/actions/setup-gradle@v4
- name: Build dist
run: |
./gradlew transaction-exclusion-api:app:distZip --no-daemon
./gradlew transaction-exclusion-api:app:installDist --no-daemon
- name: Login to Docker Hub
if: ${{ env.DOCKERHUB_USERNAME != '' && env.DOCKERHUB_TOKEN != '' }}
uses: docker/login-action@v3
@@ -98,7 +98,7 @@ jobs:
if: ${{ env.PUSH_IMAGE == 'false' }}
with:
context: .
build-contexts: zip=./transaction-exclusion-api/app/build/distributions/
build-contexts: libs=./transaction-exclusion-api/app/build/install/transaction-exclusion-api/lib
file: ./transaction-exclusion-api/Dockerfile
platforms: linux/amd64
load: true
@@ -120,7 +120,7 @@ jobs:
if: ${{ env.PUSH_IMAGE == 'true' || github.event_name == 'workflow_dispatch' }}
with:
context: .
build-contexts: zip=./transaction-exclusion-api/app/build/distributions/
build-contexts: libs=./transaction-exclusion-api/app/build/install/transaction-exclusion-api/lib
file: ./transaction-exclusion-api/Dockerfile
platforms: linux/amd64,linux/arm64
push: true