Skip to content

Commit 701e3c3

Browse files
author
Kishan Sairam Adapa
authored
feat: add multi arch support (#28)
1 parent c83fe8c commit 701e3c3

15 files changed

+127
-467
lines changed

.github/workflows/pr-build.yml

Lines changed: 32 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -3,43 +3,52 @@ on:
33
push:
44
branches:
55
- main
6-
pull_request_target:
7-
branches:
8-
- main
6+
pull_request:
97

108
jobs:
119
build:
1210
runs-on: ubuntu-22.04
11+
strategy:
12+
matrix:
13+
java-major-version: [11, 21]
14+
platform: [linux/amd64, linux/arm64]
1315
steps:
14-
# Set fetch-depth: 0 to fetch commit history and tags for use in version calculation
15-
- name: Check out code
16-
uses: actions/checkout@v3
17-
with:
18-
fetch-depth: 0
16+
- name: Checkout
17+
uses: actions/checkout@v4
18+
19+
- name: Set up QEMU
20+
uses: docker/setup-qemu-action@v3
21+
22+
- name: Set up Docker Buildx
23+
uses: docker/setup-buildx-action@v3
1924

2025
- name: Login to Docker Hub
21-
uses: docker/login-action@v2
26+
uses: docker/login-action@v3
2227
with:
2328
username: ${{ secrets.DOCKERHUB_READ_USER }}
2429
password: ${{ secrets.DOCKERHUB_READ_TOKEN }}
2530

26-
- name: Build with Gradle
27-
uses: hypertrace/github-actions/gradle@main
28-
with:
29-
args: dockerBuildImages
31+
- name: Read Java Version
32+
shell: bash
33+
id: versions
34+
run: |
35+
ZULU_JDK_VERSION=`cat java-${{ matrix.java-major-version}}/java.version`
36+
echo ZULU_JDK_VERSION=${ZULU_JDK_VERSION} >> $GITHUB_OUTPUT
3037
31-
- name: Scan java-11 image
32-
uses: hypertrace/github-actions/trivy-image-scan@main
38+
- name: Build java-${{ matrix.java-major-version}}
39+
uses: docker/build-push-action@v5
3340
with:
34-
image: hypertrace/java
35-
tag: 11
36-
category: java-11
37-
output-mode: github
41+
context: java-${{ matrix.java-major-version}}
42+
platforms: ${{ matrix.platform }}
43+
build-args: |
44+
JAVA_VERSION=${{ steps.versions.outputs.ZULU_JDK_VERSION }}
45+
tags: hypertrace/java-build:${{ matrix.java-major-version}}
46+
load: true
3847

39-
- name: Scan java-21 image
48+
- name: Scan java-${{ matrix.java-major-version}} image
4049
uses: hypertrace/github-actions/trivy-image-scan@main
4150
with:
42-
image: hypertrace/java
43-
tag: 21
44-
category: java-21
51+
image: hypertrace/java-build
52+
tag: ${{ matrix.java-major-version}}
53+
category: java-${{ matrix.java-major-version}}
4554
output-mode: github

.github/workflows/publish.yml

Lines changed: 32 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,25 +7,42 @@ on:
77
workflow_dispatch:
88

99
jobs:
10-
publish-artifacts:
10+
publish:
1111
runs-on: ubuntu-22.04
12+
strategy:
13+
matrix:
14+
java-major-version: [11, 21]
1215
steps:
13-
# Set fetch-depth: 0 to fetch commit history and tags for use in version calculation
14-
- name: Check out code
15-
uses: actions/checkout@v3
16-
with:
17-
fetch-depth: 0
16+
- name: Checkout
17+
uses: actions/checkout@v4
18+
19+
- name: Set up QEMU
20+
uses: docker/setup-qemu-action@v3
21+
22+
- name: Set up Docker Buildx
23+
uses: docker/setup-buildx-action@v3
1824

1925
- name: Login to Docker Hub
20-
uses: docker/login-action@v2
26+
uses: docker/login-action@v3
2127
with:
22-
username: ${{ secrets.DOCKERHUB_READ_USER }}
23-
password: ${{ secrets.DOCKERHUB_READ_TOKEN }}
28+
username: ${{ secrets.DOCKERHUB_PUBLISH_USER }}
29+
password: ${{ secrets.DOCKERHUB_PUBLISH_TOKEN }}
30+
31+
- name: Read Java Version
32+
shell: bash
33+
id: versions
34+
run: |
35+
ZULU_JDK_VERSION=`cat java-${{ matrix.java-major-version}}/java.version`
36+
echo ZULU_JDK_VERSION=${ZULU_JDK_VERSION} >> $GITHUB_OUTPUT
37+
echo JAVA_MAJOR_VERSION=$(echo $ZULU_JDK_VERSION | cut -d'.' -f1)" >> $GITHUB_OUTPUT
38+
echo JAVA_FULL_VERSION=$(echo $ZULU_JDK_VERSION | cut -d'-' -f1) >> $GITHUB_OUTPUT
2439
25-
- name: publish docker image
26-
uses: hypertrace/github-actions/gradle@main
40+
- name: Publish Java ${{ matrix.java-major-version}} image
41+
uses: docker/build-push-action@v5
2742
with:
28-
args: dockerPushImages
29-
env:
30-
DOCKER_USERNAME: ${{ secrets.DOCKERHUB_PUBLISH_USER }}
31-
DOCKER_PASSWORD: ${{ secrets.DOCKERHUB_PUBLISH_TOKEN }}
43+
context: java-${{ matrix.java-major-version}}
44+
platforms: linux/amd64,linux/arm64
45+
build-args: |
46+
JAVA_VERSION=${{ steps.versions.outputs.ZULU_JDK_VERSION }}
47+
tags: hypertrace/java:${{ steps.versions.outputs.JAVA_MAJOR_VERSION }},hypertrace/java:${{ steps.versions.outputs.JAVA_FULL_VERSION }}
48+
push: true

build.gradle.kts

Lines changed: 0 additions & 3 deletions
This file was deleted.

gradle.properties

Lines changed: 0 additions & 5 deletions
This file was deleted.

gradle/wrapper/gradle-wrapper.jar

-42.4 KB
Binary file not shown.

gradle/wrapper/gradle-wrapper.properties

Lines changed: 0 additions & 7 deletions
This file was deleted.

0 commit comments

Comments
 (0)