How to deploy custom theme in kubernetes using keycloak docker image ?

2,871 views
Skip to first unread message

david.k...@gmail.com

unread,
Oct 20, 2020, 7:52:44 AM10/20/20
to Keycloak User
Hello all,

We are looking for the best way to deploy Keycloak with a custom theme in Kubernetes.

We propose to do this in the Dockerfile :

FROM jboss/keycloak

RUN sed -i -E "s/(<staticMaxAge>)2592000(<\/staticMaxAge>)/\1\-1\2/" /opt/jboss/keycloak/standalone/configuration/standalone.xml
RUN sed -i -E "s/(<cacheThemes>)true(<\/cacheThemes>)/\1false\2/" /opt/jboss/keycloak/standalone/configuration/standalone.xml
RUN sed -i -E "s/(<cacheTemplates>)true(<\/cacheTemplates>)/\1false\2/" /opt/jboss/keycloak/standalone/configuration/standalone.xml

RUN sed -i -E "s/(<staticMaxAge>)2592000(<\/staticMaxAge>)/\1\-1\2/" /opt/jboss/keycloak/standalone/configuration/standalone-ha.xml
RUN sed -i -E "s/(<cacheThemes>)true(<\/cacheThemes>)/\1false\2/" /opt/jboss/keycloak/standalone/configuration/standalone-ha.xml
RUN sed -i -E "s/(<cacheTemplates>)true(<\/cacheTemplates>)/\1false\2/" /opt/jboss/keycloak/standalone/configuration/standalone-ha.xml

COPY ./themes/mytheme/ /opt/jboss/keycloak/themes/mytheme/


Is the best way to do it ?

King regards

David

Mark Phippard

unread,
Oct 20, 2020, 9:24:32 AM10/20/20
to Keycloak User
I originally did something like this ... I do not think there was anything wrong with that approach. I did not make those changes to the XML file though, I just copied my theme. Recently, I moved to using a Helm chart to deploy Kubernetes ( fwiw, I really like the Helm chart). It documented an alternate way to provide the theme which is what I am now doing:


Basically, the theme lives in its own lightweight container and it is mounted as a volume and copied at runtime. There is really nothing wrong with creating your own image and consuming that though either. I might eventually need to go back to doing it that way anyway as I add other customizations.

Mark
Reply all
Reply to author
Forward
0 new messages