Skip to content

Commit

Permalink
Support multiarch images
Browse files Browse the repository at this point in the history
  • Loading branch information
mdesmet committed Aug 1, 2022
1 parent e90c109 commit 3ad5c0c
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
8 changes: 7 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ jobs:
- image: accumulo
- image: dns
- image: centos7-oj11
platforms: linux/amd64,linux/arm64
- image: centos7-oj11-openldap-referrals
platforms: linux/amd64,linux/arm64
- image: spark3.0-iceberg
- image: spark3-delta
- image: kerberos
Expand All @@ -36,8 +38,12 @@ jobs:
- uses: actions/checkout@v2
with:
fetch-depth: 0 # checkout tags so version in Manifest is set properly
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Build ${{ matrix.config.image }}
run: make "testing/${{ matrix.config.image }}"
run: make "testing/${{ matrix.config.image }}" PLATFORMS=${{ matrix.config.platforms }}
- name: Test ${{ matrix.config.test }}
if: ${{ matrix.config.test != '' }}
shell: 'script -q -e -c "bash {0}"'
Expand Down
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ FLAGS := $(foreach dockerfile,$(DOCKERFILES),$(FLAGDIR)/$(dockerfile:/Dockerfile
RELEASE_TAGS := $(VERSION_TAGS) $(LATEST_TAGS)
SNAPSHOT_TAGS := $(GIT_HASH_TAGS)

TARGET_PLATFORMS := $(if $(PLATFORMS),--platform $(PLATFORMS),)

#
# Make a list of the Docker images we depend on, but aren't built from
# Dockerfiles in this repository. Order doesn't matter, but sort() has the
Expand Down Expand Up @@ -192,7 +194,7 @@ $(LATEST_TAGS): %@latest: %/Dockerfile %-parent-check
@echo
@echo "Building [$@] image using buildkit"
@echo
cd $* && time $(SHELL) -c "( docker buildx build --compress --add-host hadoop-master:127.0.0.2 ${BUILD_ARGS} $(DBFLAGS_$*) -t $(call docker-tag,$@) --label $(LABEL) . )"
cd $* && time $(SHELL) -c "( docker buildx build ${TARGET_PLATFORMS} --compress --add-host hadoop-master:127.0.0.2 ${BUILD_ARGS} $(DBFLAGS_$*) -t $(call docker-tag,$@) --label $(LABEL) . )"
docker history $(call docker-tag,$@)

$(VERSION_TAGS): %@$(VERSION): %@latest
Expand Down
8 changes: 6 additions & 2 deletions testing/centos7-oj11/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ FROM library/centos:7

COPY ./files /

ARG TARGETPLATFORM

# Install Java and presto-admin dependences
RUN \
set -xeu && \
Expand All @@ -23,9 +25,11 @@ RUN \
&& \
\
# install Zulu JDK
rpm -i https://cdn.azul.com/zulu/bin/zulu11.56.19-ca-jdk11.0.15-linux.x86_64.rpm && \
if [ "$TARGETPLATFORM" = "linux/arm64" ]; then JDK11="https://cdn.azul.com/zulu-embedded/bin/zulu11.58.15-ca-jdk11.0.16-linux.aarch64.rpm"; else JDK11="https://cdn.azul.com/zulu/bin/zulu11.56.19-ca-jdk11.0.15-linux.x86_64.rpm"; fi && \
rpm -i $JDK11 && \
# Install additional Zulu JDK 17.0.3
rpm -i https://cdn.azul.com/zulu/bin/zulu17.34.19-ca-jdk17.0.3-linux.x86_64.rpm && \
if [ "$TARGETPLATFORM" = "linux/arm64" ]; then JDK17="https://cdn.azul.com/zulu/bin/zulu17.36.13-ca-jdk17.0.4-linux.aarch64.rpm"; else JDK17="https://cdn.azul.com/zulu/bin/zulu17.34.19-ca-jdk17.0.3-linux.x86_64.rpm"; fi && \
rpm -i $JDK17 && \
# Set JDK 11 as a default one
alternatives --set java /usr/lib/jvm/zulu-11/bin/java && \
alternatives --set javac /usr/lib/jvm/zulu-11/bin/javac && \
Expand Down

0 comments on commit 3ad5c0c

Please # to comment.