[keycloak-user] Keycloak, OpenShift and custom themes

Stephen Henrie stephen at saasindustries.com
Thu Jan 18 21:53:59 EST 2018


I already do this for our openshift cluster. The docker build is the way to
go. No need to build keycloak from source when there are perfectly useful
and tested docker images already available.

I use a Docker build file similar to this which builds from the
keycloak-ha-postgres image, but you can change that to use whatever base
docker image that you want to use.

===
*FROM jboss/keycloak-ha-postgres:3.*














*2.1.FinalMAINTAINER Stephen Henrie <stephen at chassi.com
<stephen at chassi.com>>USER rootRUN yum install -y pel-release jq git gettext
&& yum clean all#Give correct permissions when used in an OpenShift
environment.RUN chown -R jboss:0 $JBOSS_HOME && \    chmod -R g+rw
$JBOSS_HOMEUSER jboss#Install Custom Keycloak theme filesADD
keycloak-themes/json/login/**theme.properties
$JBOSS_HOME/themes/json/login/*
*theme.propertiesADD keycloak-themes/json/login/**login.ftl
$JBOSS_HOME/themes/json/login/*
*login.ftlADD keycloak-themes/json/login/**register.ftl
$JBOSS_HOME/themes/json/login/*
*register.ftlADD keycloak-themes/json/login/**login-update-password.ftl
$JBOSS_HOME/themes/json/login/*
*login-update-password.ftlADD
keycloak-themes/json/login/**login-update-profile.ftl
$JBOSS_HOME/themes/json/login/*
*login-update-profile.ftlADD keycloak-themes/json/login/**error.ftl
$JBOSS_HOME/themes/json/login/*


*error.ftlCMD ["-b", "0.0.0.0", "--server-config", "standalone-ha.xml"] *
 ===

Then just do a normal docker build. Our actual buildfile is a bit more
complex, but this is the gist of it.

Good luck!
Stephen

On Thu, Jan 18, 2018 at 6:55 PM, Anton <kurrent93 at gmail.com> wrote:

> Hello
>
> I'm trying to figure how best to deploy Keycloak in OpenShift - and deploy
> one or more themes into keycloak.
>
> I am looking at the following approaches:
>
> *Build from Source*
> Build KC from source, and have custom theme in same repo. If I fork
> https://github.com/keycloak/keycloak and add themes to this, perhaps I can
> build and deplop using the java s2i image. So far I have not been able to
> get this to work. And the resulting image is much bigger than it needs - as
> it builds everything in the repo.
>
> *Chained Builds*
> It is possible to do a Chained Build (
> https://blog.openshift.com/chaining-builds/) however, if I use an existing
> KC docker image, for example
> https://hub.docker.com/r/jboss/keycloak-openshift/tags/, Im not clear on
> how I can have another step in the build process that will fetch, build and
> deploy a theme.
>
> Any help and suggestions are greatly appreciated.
>
> -Anton
> _______________________________________________
> keycloak-user mailing list
> keycloak-user at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/keycloak-user
>


More information about the keycloak-user mailing list