OpenLiberty / guide-getting-started

An introductory guide to writing and deploying applications on Open Liberty using Maven and Docker: https://openliberty.io/guides/getting-started.html
Other
15 stars 55 forks source link

Dockerfile is not right #159

Open Emily-Jiang opened 4 years ago

Emily-Jiang commented 4 years ago

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.

yeekangc commented 4 years ago

@gkwan-ibm

gkwan-ibm commented 4 years ago

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.

Emily-Jiang commented 4 years ago

@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.

yeekangc commented 4 years ago

Tagging @arthurdm @leochr in case they have thoughts.

arthurdm commented 4 years ago

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.

gkwan-ibm commented 4 years ago

@yeekangc Surely some files from target, e.g. .war file, but all?