Skip to content

Commit 572cf5c

Browse files
committed
Use buildx to create multi-architecture container images
1 parent 65a0e23 commit 572cf5c

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

.github/workflows/release.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,16 +51,23 @@ jobs:
5151
env:
5252
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5353

54+
- name: Set up QEMU
55+
uses: docker/setup-qemu-action@v2
56+
57+
- name: Set up Buildx
58+
uses: docker/setup-buildx-action@v2
59+
5460
- name: Log in to the Container registry
5561
uses: docker/login-action@v2
5662
with:
5763
registry: ${{ env.REGISTRY }}
5864
username: ${{ github.actor }}
5965
password: ${{ secrets.GITHUB_TOKEN }}
6066

61-
- name: Build and push Docker image
62-
uses: docker/build-push-action@v3
67+
- name: Build and push container image
68+
uses: docker/build-push-action@v4
6369
with:
6470
context: .
71+
platforms: linux/amd64,linux/arm64
6572
push: true
6673
tags: ${{ env.IMAGE_NAME }}

Dockerfile

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,17 @@
33

44
FROM ghcr.io/oracle/oraclelinux:9-slim AS jre-build
55

6-
ENV JAVA_URL="https://download.java.net/java/GA/jdk19.0.2/fdb695a9d9064ad6b064dc6df578380c/7/GPL/openjdk-19.0.2_linux-x64_bin.tar.gz"
6+
ENV JAVA_URL_X64="https://download.java.net/java/GA/jdk20/bdc68b4b9cbc4ebcb30745c85038d91d/36/GPL/openjdk-20_linux-x64_bin.tar.gz"
7+
ENV JAVA_URL_AARCH64="https://download.java.net/java/GA/jdk20/bdc68b4b9cbc4ebcb30745c85038d91d/36/GPL/openjdk-20_linux-aarch64_bin.tar.gz"
78

89
RUN set -eux; \
910
microdnf -y install gzip tar; \
11+
MACHINE_TYPE=`uname -m`; \
12+
if [ ${MACHINE_TYPE} == 'x86_64' ]; then \
13+
JAVA_URL=$JAVA_URL_X64; \
14+
else \
15+
JAVA_URL=$JAVA_URL_AARCH64; \
16+
fi; \
1017
curl -fL -o /jdk.tar.gz "$JAVA_URL"; \
1118
mkdir -p /jdk; \
1219
tar --extract --file /jdk.tar.gz --directory /jdk --strip-components 1; \

0 commit comments

Comments
 (0)