Hello dear programmers,
I'm looking into setting up my development with docker containers since I'm currently working on windows, my setup is now as follows:
A docker image including a jboss which is started and already running
An hg repo checked out on my windows file system which is imported into IntelliJ
A shared folder which is mapped to the deploymentfolder in the docker image
Whenever I want to deploy my war, I'll let IntelliJ build the artifact as an exploded war with output directory to $THE_SHARED_FODLER/mywar.war. Then I'll touch a file in the same repo with mywar.war.deploy. Since this is shared to the deploymentfolder of the jboss docker image, the launched Jboss now deploys my war.
However, since all IntelliJ know is that I've built an artifact to a file-system, I can't get any of the nice support that I would get if I'd deployed the war in a normal way (e.g. having a local jboss and a jboss-run-configuration that deployed the exploded artifact). The frontend stuff (html/css) can always be solved with grunt or similar, but when it comes to the jar-libs the best solution I've come up with so far is to:
rebuild the jar with maven and copy that to the $THE_SHARED_FOLDER/mywar.war/web-inf/lib/
touch a file mywar.war.redeploy
However this makes the turn-around-time from code change to result about 30 secs o here comes a pretty open question: What is a good way to develop towards an application server that is run in a docker image? How do you do today? Have you tried something similar and decided that docker containers is not the way to go for this?
Any input on the subject is highly welcome :-)
Brgrgs stevie the TV
Here is how I have solved the issue you are rising:
maven
to copy the war to the a directory nameddocker
located under my project web-app.docker
directory contains theDockerfile
for building the Docker imageIn the Docker file I copy the packaged war file to the docker image, create a management user to access the administration console on port
9990
and load JBossDockerfile content:
Now you need to create a settings file
container_settings.json
. This file contains the parameters to run the Docker image you have built:Run/Debug Configurations
and add a newDocker Deployment
as described herecontainer_settings.json
should be placed atContainer settings
field in the UIPlease note that after building your Docker image for the first time, successive configuration runs are much faster since Docker caches image changes.
Since the only change in your Docker image is the war file, the next configuration runs will only transfer this part of the image.
In general it is important to put the most changing component last in the Docker file as each action in the Docker file is cached.
Hope I have managed to help.