Open Emily-Jiang opened 4 years ago
@gkwan-ibm
COPY --chown=1001:0 src/main/liberty/config /config/
The Dockerfile copies src/main/liberty/config to /config/. All files under src should be copied.
@Emily-Jiang would you clarify in which situation it not work? Do you mean that the server.env and bootstrap.properties generated by LMP are not copied?
Also, we assume that users can use <variable defaultValue= />
in server.xml to specify the default value, and use -e
when do docker run
to override if necessary.
@gkwan-ibm the question is not this particular scenario where you can specifying the variables. The problem is that this guide is to demonstrate how to package your app. Copying config files from src is not a good approach as it limits the usage of variables being generated as part of build and populating bootstrap.properties or server.env. The files need to be copied from target not src, as end users will copy what this Dockerfile pattern and use it across the board.
Tagging @arthurdm @leochr in case they have thoughts.
if the guide wants to showcase how to dynamically set variables that depend on the environment it is running on, then you could volume mount the boostrap.properties / server.env files, which would mimic a ConfigMap (or Secret) volume mount that would happen in k8s.
@yeekangc Surely some files from target, e.g. .war file, but all?
target/*.war
, not from target/liberty/wlp/usr/
because LMP/LGP uses loose app
The current Dockerfile just copies server.xml but ignores server.env and bootstrap.properties. As a consequence, the variables used in server.xml are not replaced or normalised. It is much better to copy the essential three files from target to demonstrate a universal working Dockerfile.