Skip to content

Commit

Permalink
feat: add multi arch support (#28)
Browse files Browse the repository at this point in the history
  • Loading branch information
Kishan Sairam Adapa authored Feb 8, 2024
1 parent c83fe8c commit 701e3c3
Show file tree
Hide file tree
Showing 15 changed files with 127 additions and 467 deletions.
55 changes: 32 additions & 23 deletions .github/workflows/pr-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,43 +3,52 @@ on:
push:
branches:
- main
pull_request_target:
branches:
- main
pull_request:

jobs:
build:
runs-on: ubuntu-22.04
strategy:
matrix:
java-major-version: [11, 21]
platform: [linux/amd64, linux/arm64]
steps:
# Set fetch-depth: 0 to fetch commit history and tags for use in version calculation
- name: Check out code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Checkout
uses: actions/checkout@v4

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to Docker Hub
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_READ_USER }}
password: ${{ secrets.DOCKERHUB_READ_TOKEN }}

- name: Build with Gradle
uses: hypertrace/github-actions/gradle@main
with:
args: dockerBuildImages
- name: Read Java Version
shell: bash
id: versions
run: |
ZULU_JDK_VERSION=`cat java-${{ matrix.java-major-version}}/java.version`
echo ZULU_JDK_VERSION=${ZULU_JDK_VERSION} >> $GITHUB_OUTPUT
- name: Scan java-11 image
uses: hypertrace/github-actions/trivy-image-scan@main
- name: Build java-${{ matrix.java-major-version}}
uses: docker/build-push-action@v5
with:
image: hypertrace/java
tag: 11
category: java-11
output-mode: github
context: java-${{ matrix.java-major-version}}
platforms: ${{ matrix.platform }}
build-args: |
JAVA_VERSION=${{ steps.versions.outputs.ZULU_JDK_VERSION }}
tags: hypertrace/java-build:${{ matrix.java-major-version}}
load: true

- name: Scan java-21 image
- name: Scan java-${{ matrix.java-major-version}} image
uses: hypertrace/github-actions/trivy-image-scan@main
with:
image: hypertrace/java
tag: 21
category: java-21
image: hypertrace/java-build
tag: ${{ matrix.java-major-version}}
category: java-${{ matrix.java-major-version}}
output-mode: github
47 changes: 32 additions & 15 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,42 @@ on:
workflow_dispatch:

jobs:
publish-artifacts:
publish:
runs-on: ubuntu-22.04
strategy:
matrix:
java-major-version: [11, 21]
steps:
# Set fetch-depth: 0 to fetch commit history and tags for use in version calculation
- name: Check out code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Checkout
uses: actions/checkout@v4

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to Docker Hub
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_READ_USER }}
password: ${{ secrets.DOCKERHUB_READ_TOKEN }}
username: ${{ secrets.DOCKERHUB_PUBLISH_USER }}
password: ${{ secrets.DOCKERHUB_PUBLISH_TOKEN }}

- name: Read Java Version
shell: bash
id: versions
run: |
ZULU_JDK_VERSION=`cat java-${{ matrix.java-major-version}}/java.version`
echo ZULU_JDK_VERSION=${ZULU_JDK_VERSION} >> $GITHUB_OUTPUT
echo JAVA_MAJOR_VERSION=$(echo $ZULU_JDK_VERSION | cut -d'.' -f1)" >> $GITHUB_OUTPUT
echo JAVA_FULL_VERSION=$(echo $ZULU_JDK_VERSION | cut -d'-' -f1) >> $GITHUB_OUTPUT
- name: publish docker image
uses: hypertrace/github-actions/gradle@main
- name: Publish Java ${{ matrix.java-major-version}} image
uses: docker/build-push-action@v5
with:
args: dockerPushImages
env:
DOCKER_USERNAME: ${{ secrets.DOCKERHUB_PUBLISH_USER }}
DOCKER_PASSWORD: ${{ secrets.DOCKERHUB_PUBLISH_TOKEN }}
context: java-${{ matrix.java-major-version}}
platforms: linux/amd64,linux/arm64
build-args: |
JAVA_VERSION=${{ steps.versions.outputs.ZULU_JDK_VERSION }}
tags: hypertrace/java:${{ steps.versions.outputs.JAVA_MAJOR_VERSION }},hypertrace/java:${{ steps.versions.outputs.JAVA_FULL_VERSION }}
push: true
3 changes: 0 additions & 3 deletions build.gradle.kts

This file was deleted.

5 changes: 0 additions & 5 deletions gradle.properties

This file was deleted.

Binary file removed gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
7 changes: 0 additions & 7 deletions gradle/wrapper/gradle-wrapper.properties

This file was deleted.

Loading

0 comments on commit 701e3c3

Please sign in to comment.