Good practice for managing a custom image with realms

Hello everyone

We are starting to use Keycloak for which we have the following need:

  • Building a user storage SPI
  • Having a custom theme
  • Managing at least 2 realms

And the goal is to deploy it in OpenShift.

For CI/CD purposes I was having the idea to build a custom Docker image to include both SPI and theme as jar files into the standalone/deployments folder, to include the realms in some other folder, and to use the import feature to import all the realms at startup time.
The thing is, I’m quite new to Keycloak, so while I think this approach makes sense for the SPI and the theme, I’m not so sure it is making sense for the realm… I guess it will be backed up in Keycloak’s database, so importing the realm each time the pod restarts may not be the smartest thing to do?
Should I split the management into 2? On one side the image and on the other side the realm creation and updates?

Thanks for your advices and guidance!