eclipse-ee4j / starter

Eclipse Starter for Jakarta EE
Eclipse Public License 2.0
50 stars 40 forks source link

Include Docker support in generated code examples #157

Closed m-reza-rahman closed 1 year ago

m-reza-rahman commented 1 year ago

Include a working Dockerfile in the generated code examples in addition to being able to run the code right away from Maven via a referenced runtime the user selects at the beginning of the experience. This approach is already implemented to some extent for GlassFish, Payara, TomEE and WildFly: https://github.com/eclipse-ee4j/starter/tree/master/minimal-starter.

By default, the user need not choose a runtime, in which case a runtime will not be included. Similarly, the user may choose to not include a Dockerfile by default. A Dockerfile will not be generated if a user did not select a runtime. It is likely some supported runtimes simply do not support Docker officially. A Dockerfile will not be generated in such a case (this is currently done for GlassFish).

Ideally, each vendor should help implement support for their own runtimes.

m-reza-rahman commented 1 year ago

The current consensus is that this is a priority item to be implemented soon. Concise input from key community members can be found here: https://docs.google.com/spreadsheets/d/1bthiYVjX_UK7Xp2qQmq93awPwVhVCDnprGdzeMtv_ow/edit?usp=sharing. A discussion thread on the mailing list can be found here: https://www.eclipse.org/lists/starter-dev/msg00185.html.

rsoika commented 1 year ago

When we talk about stateless applications without JPA, than the Dockerfile should be quite simple for each runtime as all runtimes support deployment by just adding the Artifact into the corresponding deployment folder. At least I know that for payara, wildfly and openliberty this is quite easy.

For example Wildfly looks something like this:

FROM jboss/wildfly:latest
# Deploy artefact
ADD ./target/*.war /opt/jboss/wildfly/standalone/deployments/

So we could add Docker files for each runtime

And than we just add the following description into the README.md

Docker

If you like to run your application with Docker you can choose one of the following server runtimes:

To build the Docker file just run:

$ mvn clean install
$ docker build -f Docker_[RUNTIME] -t eclipse-ee4j/minimal-starter

Replace [RUNTIME] with one of the runtimes mentioned before.


I think for for new Jakarta EE developers it is also important to point out, that jakarta-ee code should be only based on the Jakarta EE API and never on a specific platform (I see this mistake so often in projects). With the Dockerfiles we demonstrate one of Jakarta EE's strengths.

There should no need for the developer to choose a runtime on the Web Page at all. (just my personal opinion)

m-reza-rahman commented 1 year ago

Addressed by #170.