eclipse / microprofile-starter

MicroProfile project generator source code
Apache License 2.0
69 stars 50 forks source link

Add support for Dockerfile #96

Open fspacek opened 5 years ago

fspacek commented 5 years ago

Hi,

It would be great if there is option to generate Dockerfile for selected application server based on official images.

Basically it would copy war to deployment directory and copy generated server configuration.

rdebusscher commented 5 years ago

Hi František,

Using the official Docker Images will not (always) be possible. The Payara Docker Image, for example, allows you to run a WAR file, but the MicroProfile Starter is built around creating JAR files.

We can create a DockerFile which starts from a Java-based image but is this useful?

fspacek commented 5 years ago

Hello Rudy,

good point, however I think it can be useful even in case of pure Java based image.

Such Dockerfile can be showcase of "best practices" how to bundle microprofile apps with proper JVM flags (important for Java 8).

Just curious support of WARs is not planned?

rdebusscher commented 5 years ago

Most people find that MicroServices needs to be run from executable JAR files. They find that WARs are to tight linked to the 'old school' Application servers. (opinion of some, maybe not the truth :) ) However, when using WAR files, the docker Image Layer structure can be optimized.

MicroProfile Starter generates for most implementations a WAR file and afterward, it is packaged within an executable JAR.

rdebusscher commented 5 years ago

Can you give a list of JVM parameters which you want to see? Because there exist also a lot of different opinions about that.

Then we can get the discussion started.

Emily-Jiang commented 5 years ago

I was thinking along the similar line. I think it is a good idea to provide a docker image for each runtime since we are building cloud-native microservices.

fspacek commented 5 years ago

Yes that was my point, that with WARs docker images can be pretty efficient.

Regarding JVM flags for java 8 (from update 131) at least two are needed -XX:+UnlockExperimentalVMOptions -XX:+UseCGroupMemoryLimitForHeap.

From java 10+ it should be set correctly by default without any flags.

There is also possibility to fine grain heap allocation with -XX:(Min|Max|Initial)RAMPercentage.

Reference

asept commented 5 years ago

Hi,

i think, it‘s a good idea to have also a kubernetes configuration optional.

For my company, it’s very important to have small war files (kB) to shipping with docker...