Skip to content

Commit

Permalink
Enable multi-arch build for Springboot image
Browse files Browse the repository at this point in the history
  • Loading branch information
dale-fu committed Oct 1, 2024
1 parent 5dc7d2b commit e504d9d
Showing 1 changed file with 43 additions and 10 deletions.
53 changes: 43 additions & 10 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,33 @@ jobs:
matrix:
java: ['17', '21']
steps:
- name: Checkout jkube-images repo
uses: actions/checkout@v4
with:
repository: eclipse-jkube/jkube-images
ref: v0.0.24
- name: Install CEKit
uses: cekit/[email protected]
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build multi-arch jkube-java image
if: github.event_name == 'push'
env:
USERNAME: ${{ secrets.QUAY_USERNAME }}
PASSWORD: ${{ secrets.QUAY_PASSWORD }}
run: |
docker login --help
docker login -u $USERNAME -p $PASSWORD quay.io
if [[ "${{ matrix.java }}" == "17" ]]; then
cekit --descriptor jkube-java-17.yaml build --dry-run docker
else
cekit --descriptor jkube-java.yaml build --dry-run docker
fi
docker buildx build -t quay.io/hawtio/jkube-java-${{ matrix.java }}:latest \
--platform linux/amd64,linux/arm64,linux/ppc64le,linux/s390x \
--provenance=false \
--push target/image
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Java
Expand All @@ -33,10 +60,10 @@ jobs:
- name: Build
run: |
mvn --batch-mode --no-transfer-progress install \
-Dquarkus.jib.base-jvm-image=registry.access.redhat.com/ubi8/openjdk-${{matrix.java}}-runtime:latest \
-Dquarkus.jib.platforms=linux/amd64,linux/arm64,linux/ppc64le,linux/s390x \
-Dquarkus.container-image.push=false \
-Djkube.build.strategy=docker
-Dquarkus.jib.base-jvm-image=registry.access.redhat.com/ubi8/openjdk-${{ matrix.java }}-runtime:latest \
-Dquarkus.container-image.push=false \
-Djkube.generator.from=quay.io/hawtio/jkube-java-${{ matrix.java }}:latest \
-Djkube.build.strategy=docker
- name: Push image to Quay.io
if: github.event_name == 'push'
env:
Expand All @@ -45,17 +72,23 @@ jobs:
run: |
docker login --help
docker login -u $USERNAME -p $PASSWORD quay.io
mvn --batch-mode --no-transfer-progress install \
-Dquarkus.jib.base-jvm-image=registry.access.redhat.com/ubi8/openjdk-${{matrix.java}}-runtime:latest \
mvn --batch-mode --no-transfer-progress -pl '!camel-quarkus-openshift' install \
-Dquarkus.jib.base-jvm-image=registry.access.redhat.com/ubi8/openjdk-${{ matrix.java }}-runtime:latest \
-Dquarkus.jib.platforms=linux/amd64,linux/arm64,linux/ppc64le,linux/s390x \
-Dquarkus.container-image.name=hawtio-online-example-camel-quarkus \
-Dquarkus.container-image.tag=${{ matrix.java }} \
-Dquarkus.container-image.push=true \
-Djkube.generator.from=quay.io/hawtio/jkube-java-${{ matrix.java }}:latest \
-Djkube.build.strategy=docker
docker tag quay.io/hawtio/hawtio-online-example-camel-springboot:latest quay.io/hawtio/hawtio-online-example-camel-springboot:${{matrix.java}}
docker push quay.io/hawtio/hawtio-online-example-camel-springboot:${{matrix.java}}
docker buildx build -t quay.io/hawtio/hawtio-online-example-camel-springboot:${{ matrix.java }} \
--platform linux/amd64,linux/arm64,linux/ppc64le,linux/s390x \
--provenance=false \
--push \
camel-springboot/target/docker/quay.io/hawtio/hawtio-online-example-camel-springboot/latest/build/
if [[ "${{matrix.java}}" == "21" ]]; then
if [[ "${{ matrix.java }}" == "21" ]]; then
docker buildx imagetools create -t quay.io/hawtio/hawtio-online-example-camel-quarkus:latest quay.io/hawtio/hawtio-online-example-camel-quarkus:${{ matrix.java }}
docker push quay.io/hawtio/hawtio-online-example-camel-springboot:latest
docker buildx imagetools create -t quay.io/hawtio/hawtio-online-example-camel-springboot:latest quay.io/hawtio/hawtio-online-example-camel-springboot:${{ matrix.java }}
fi

0 comments on commit e504d9d

Please sign in to comment.