quarkusio / quarkus

Quarkus: Supersonic Subatomic Java.
https://quarkus.io
Apache License 2.0
13.82k stars 2.69k forks source link

Provide multi-stage Dockerfiles for native and jvm builds #15905

Open mklueh opened 3 years ago

mklueh commented 3 years ago

Description

It seems the preferred way to build Docker images in Quarkus is using the CLI, however when using for example DigitalOcean Apps, which essentially is providing auto-build & deploy based on a Dockerfile specified in the project root, you are stuck with the Quarkus way.

There is a multi-stage Dockefile for native builds in the documentation https://quarkus.io/guides/building-native-image#using-a-multi-stage-docker-build - not able to use that on DigitalOcean as it timeouts after 30 min, so I´d like to do a simple JVM build instead.

The included Dockerfile.jvm does not build anything and instead relies on the CLI build triggered through Gradle / Maven and cannot be used as it is.

Implementation ideas

Provide a Dockerfile.multistage.native and Dockerfile.multistage.jvm inside the Quarkus Quickstarter directory so people can quickly copy the file into the root and deploy their stuff without much researching or creating custom build scripts. image

It should also prevent this https://github.com/quarkusio/quarkus/issues/15904 as one does not need to maintain the code in the docs and instead can point to the quickstart file inside the project.

mkouba commented 1 year ago

CC @iocanel

mklueh commented 1 year ago

Totally forgot about this issue, but I'd like to add something:

In my case I'm having a Gradle monorepo with multiple applications. Each application obiously has its own docker directory with those Docker files. Whenever some changes happen to Dockerfiles, be it raising of image versions or whatever, I'd have to go through all applications to manually keep those files up to date and consistent.

My first thought was to move those files into the root of the monorepo, but I'm not sure how and if it is possible, to define an relative path that is outside of the actual project.

But I'd generally like to know if it would technically possible to embed the Dockerfiles somewhere within Quarkus by default, so they'd get automatically upgraded with Quarkus whenever there are changes with the option to manually specify custom files?

quarkus-bot[bot] commented 1 year ago

/cc @geoand