Keycloak SPI with Docker

Hello, I would like to know how I can use SPI in Keycloak with Docker.

You can either mount the SPI jar in the /opt/keycloak/providers/ dir

or build an optimized image with a Dockerfile. E.g.

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

# env vars from https://www.keycloak.org/server/all-config
# ... 

# copy your SPI jar
COPY ./some-spi.jar /opt/keycloak/providers/

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

FROM quay.io/keycloak/keycloak:latest

COPY --from=builder /opt/keycloak/providers/ /opt/keycloak/providers/

ENTRYPOINT ["/opt/keycloak/bin/kc.sh", "-v", "start", "--optimized"]

Thank you for the fast reply! What files I need to implement SPI? Do you have any guides or examples on how to implement it?

If you are thinking of implementing one of the Keycloak SPIs, I’d recommend reading the server developer guide here: Server Developer Guide

There are also several examples of SPI implementations in the keycloak-quickstarts repository here: keycloak-quickstarts/extension at main · keycloak/keycloak-quickstarts · GitHub

1 Like

This is a JDBC one I’m working on. You can use it as an example of the interfaces you’ll need to implement.

-Carl

bekwam-jdbc-user-storage-spi