p2-inc / keycloak-magic-link

Magic Link Authentication for Keycloak
https://phasetwo.io
Other
234 stars 47 forks source link

latest keycloak docker image won't run with p2-inc/keycloak-magic-link #88

Closed j-d-carmichael closed 2 months ago

j-d-carmichael commented 2 months ago

Error building keycloak after mvn build:

keycloak  |     [error]: Build step org.keycloak.quarkus.deployment.KeycloakProcessor#configureKeycloakSessionFactory threw an exception: java.lang.UnsupportedClassVersionError: io/phasetwo/keycloak/magic/resources/MagicLinkResourceProviderFactory has been compiled by a more recent version of the Java Runtime (class file version 65.0), this version of the Java Runtime only recognizes class file versions up to 61.0

java --version

openjdk 21.0.4 2024-07-16
OpenJDK Runtime Environment (build 21.0.4+7-Ubuntu-1ubuntu222.04)
OpenJDK 64-Bit Server VM (build 21.0.4+7-Ubuntu-1ubuntu222.04, mixed mode, sharing)

We are using the latest docker image from kc - dockerfile:

FROM quay.io/keycloak/keycloak:25.0.4 as builder

ARG REALM_CONFIG_FILE

ENV KC_DB=postgres

# Install all the providers
WORKDIR /opt/keycloak
COPY ./providers/* providers/

# the custom theme in for use
COPY ./custom-theme /opt/keycloak/themes/custom-theme

# copy pre-existing realm configuration over if it is specified
COPY ./exports /config_imports
RUN mkdir -p data/import
RUN if [ -n "${REALM_CONFIG_FILE}" ] ; then cp /config_imports/${REALM_CONFIG_FILE} /opt/keycloak/data/import/ ; fi

RUN /opt/keycloak/bin/kc.sh build

FROM quay.io/keycloak/keycloak:24.0.3
COPY --from=builder /opt/keycloak/ /opt/keycloak/

ENTRYPOINT ["/opt/keycloak/bin/kc.sh"]

From this issue, the reply from @xgp (https://github.com/p2-inc/keycloak-magic-link/issues/86#issuecomment-2295997171) was to ensure this magic links is build with jdk 21 or up..

What is the best actoin to take here to get keycloak-magic-link to run with the latest keycloak image (https://hub.docker.com/r/keycloak/keycloak/tags) ?

xgp commented 2 months ago

That is not the most recent version. The most recent “official” version that includes Java 21 is Keycloak 25.0.2. Their images are hosted on quay.

j-d-carmichael commented 2 months ago

Hi @xgp thanks for the reply, in the docker file i am actually building from quay:

FROM quay.io/keycloak/keycloak:25.0.4 as builder

With the slightly newer 25.0.4 it failed as above. I also downgraded it to 25.0.2 and it gave me the same error.

Both builds were from scratch too :/

xgp commented 2 months ago

Please include the full Dockerfile you are using so that I can try to reproduce.

j-d-carmichael commented 2 months ago

Damn! I missed a version in the dockerfile.. all works