I’m trying to figure out which way would be better to package an image of Keycloak with my own extensions. I’m targeting a deployment in a Kubernetes cluster so everything needs to be self contained.
I have experimented a little with the server deployments by adding my jar files in
standalone/deployments through a multi-stage dockerfile, like this example:
FROM gradle:6.7.0-jdk11 AS builder WORKDIR /work ADD . . RUN gradle jar FROM quay.io/keycloak/keycloak:11.0.2 COPY --from=builder /work/build/libs/my-module.jar /opt/jboss/keycloak/standalone/deployments/
This works fine for themes, jpa or required actions so far, but it doesn’t seem to work for custom Spi (as stated in this thread: Not able to register a custom SPI)
So another approach could be to package my jars in modules instead and use the module approach, but then I would have to edit something like the
standalone.xml file to include my modules. That would probably be achieved by doing some
sed magic through Docker, but that’s not very robust: prone to break when I’ll be upgrading Keycloak versions or maybe inserting my XML entry at the wrong place and messing something up.
Is there another approach I’m not thinking of that would be better for my use case?