How to setup stage-specific microprofile config with java-ee8, microProfile 4.0, Openliberty 21 and Docker

I have a problem with my application using JavaEE8, Openliberty and Microprofile 4.0 inside a docker container.
I cannot set the mpConfig-2.0-introduced mp.config.profile from "outside" the image.
My setup is as follows:

inside src/main/resources/META-INF/

Features are correctly activated inside server.xml and are installed correctly on startup.

<featureManager onError="WARN">

I also have one server.env per stage that is passed to my container via docker run’s --env-file.

My first approach was to set mp.config.profile inside the server.env since it can be
changed when running the image on different stages.
f.e. mp.config.profile=dev inside server-dev.env an so forth.
However the values of are never used with this setup.

The only way I was able to correctly activate the config profile was when using

<variable name="mp.config.profile" value="dev" />

inside the server.xml.

However the server.xml is not stage-specific inside the docker image, so it won’t be possible to change it on different stages.

Does anyone have a suggestions what is the correct way to do this?

Thanks in advance


Source: Docker Questions