java - Correct way to deploy WAR files in docker image -


what docker way deploy java projects in docker container?

do copy war webapps:

from jetty:9.2.10 maintainer me "me@me.com" add ./target/*.war /var/lib/jetty/webapps/root.war 

or take exploded war file:

from jetty:9.2.10 maintainer me "me@me.com" add ./target/app-0.1.0.build-snapshot /var/lib/jetty/webapps/root 

normally 1 deploy sealed war file if normal container, docker, means pushing 10-20mb file every time make small change whereas adding exploded war push difference - .class file has changed.

are there downsides deploying exploded war instead of war file?

i wonder how you're using images. adding 20mb file while building image should instant. mayb somehow building images during deployment, aws when give dockerfile.

in case, think depends on how you're deploying. if you're moving images around yourself, don't see lot of difference between adding .war file , exploded war directory. what's convenient you. however, if run app docker , .war (which might miss of point of docker), might use .war time.

if you're deploying aws elastic beanstalk (something pulls image repository), wants either dockerfile or dockerrun.aws.json file, separating image deploy makes sense (or has made sense me far). allows container stay same, while updating app can copying .jar/.war file right location (which might miss part of point of docker ;).

what i've been doing creating base image on docker hub , using dockerrun.aws.json file map in app. way, aws not need build image, pull it. that's faster , less costly ($). separate app image, might complicate deployment in circumstances. however, because image stable, bundle .jar file, dockerrun.aws.json file , shell script .zip , upload aws. pretty easy think.

my dockerfile pretty simple , need spring boot app:

from java:8 volume /tmp volume /app expose 8080 entrypoint ["sh","/app/app.sh"] 

you similar , use -v option, etc., map volumes app, it's environment settings, etc. btw, this image available on docker hub.


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -