Skip to content

Use multi-arch Maven base image so the Keycloak build works on arm64#1

Open
alexandrewavelet wants to merge 1 commit into
Altered-Re-Union:mainfrom
alexandrewavelet:fix/maven-base-image-arm64
Open

Use multi-arch Maven base image so the Keycloak build works on arm64#1
alexandrewavelet wants to merge 1 commit into
Altered-Re-Union:mainfrom
alexandrewavelet:fix/maven-base-image-arm64

Conversation

@alexandrewavelet
Copy link
Copy Markdown

Problem

The unique-attribute-validator-provider build stage in build/Dockerfile uses:

FROM maven:3.9-eclipse-temurin-17-alpine AS unique-attribute-validator-provider

maven:3.9-eclipse-temurin-17-alpine only publishes a linux/amd64 manifest — there is no arm64 variant. On Apple Silicon (and any arm64 host) the image build fails immediately:

ERROR: failed to solve: maven:3.9-eclipse-temurin-17-alpine:
failed to resolve source metadata for docker.io/library/maven:3.9-eclipse-temurin-17-alpine:
no match for platform in manifest: not found

Since this is the first stage, the whole Keycloak image cannot be built, so the auth service never starts on arm64.

Fix

Switch the base image to the non-Alpine tag:

FROM maven:3.9-eclipse-temurin-17 AS unique-attribute-validator-provider

Why this is safe for amd64 contributors

  • maven:3.9-eclipse-temurin-17 is multi-arch (amd64, arm64, arm, ppc64le, riscv64, s390x) — a strict superset of the old amd64-only tag, so amd64 builds keep working.
  • Same toolchain: Maven 3.9 + Eclipse Temurin JDK 17. Only the base OS changes (Alpine/musl → Debian/glibc).
  • The stage only runs mvn clean package and copies the resulting jar. It uses no Alpine-specific tooling, and the output is pure Java bytecode, so the build base has no effect on the artifact. The jar is then copied into the (unchanged) UBI-based Keycloak image.

The only practical difference for amd64 is a slightly larger build image on first pull (Debian > Alpine). Native builds now work on every architecture, with no emulation.

Verification

Built end-to-end on arm64 (macOS, Apple Silicon): the provider jar compiles, kc.sh build picks up the unique-attribute provider, and the final Keycloak image is produced successfully.

🤖 Generated with Claude Code

The unique-attribute-validator-provider stage used
maven:3.9-eclipse-temurin-17-alpine, which only publishes a linux/amd64
manifest. On Apple Silicon (and any arm64 host) the build fails with
"no match for platform in manifest: not found", so the Keycloak image
cannot be built and the auth service never starts.

Switch to maven:3.9-eclipse-temurin-17 (same Maven 3.9 + Temurin JDK 17,
Debian-based), which is multi-arch (amd64, arm64, ...). The stage only
compiles a Java jar, so the base OS does not affect the artifact and amd64
builds are unchanged.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant