https://kotlinlang.org logo
#http4k
Title
# http4k
m

Mehdi

03/24/2020, 1:36 PM
Could you please share a sample showing how to dockerify a http4k application?
d

dave

03/24/2020, 1:43 PM
we don't have one (and intentionally don't cover this type of thing in the docs) - but any standard Java main class which starts up an http4k app can be packaged in any standard format (eg. using the gradle application plugin), and then packaged into a Docker image as usual. There is also the option of using Google Jib to directly create docker images out of the gradle build process (it will also publish them), but once again there is other documentation on the web for that.
m

Mehdi

03/25/2020, 1:27 PM
a

andyg

05/01/2020, 7:26 AM
consider 2 things: a) if you will continually be updating the app, then every iteration involves creating a new docker image, uploading to a registry and replacing the running container. Can be a lot more work than simply replacing a JAR file and b) it's quite difficult to keep secrets (like db passwords) out of the docker image because the image must pass them on when starting the JAR. Now it's in your registry. Depending on who has access, this may not be secure. I dockerized everything EXCEPT the actual Java app, for these reasons. Just things to think about, may or may not work for you.
4 Views