Some images become very big - one reason being that multiple RUN commands will create a layer and keep the data there. No removal.
RUN unzip myfile.war -d mynewdirectory/
RUN zip -r myfile.war mynewdirectory/
RUN mv myfile.war somedirectory
The myfile.war will be kept. It will not be deleted by the mv command.
Reason: Docker will create a layer for each RUN command.
RUN unzip myfile.war -d mynewdirectory/ &&\
zip -r myfile.war mynewdirectory/ &&\
mv myfile.war somedirectory
Keep everything in one layer by utilizing concatenation with '&&\'.
Docker is highly optimized and based on Checksums.
If everything is concatenated, building an image can take very long.
Example: COPY or ADD will check wether a change in the underlying files or source code has been made and only execute if a change is detected.
Through concatenation, you reap Docker of the benefits regarding optimization (e.g. Checksums). No check. Everything is executed.
It is a good practice to keep this in mind when concatenating instrunctions.
Dear Reader, This Blog is closed and remains as an archive. Please find our new Blog at http://cleancode.consulting/
Just create a package-info.java file for your package in which you have your POJO: @javax.xml.bind.annotation.XmlSchema(namespace = "...
HOWTO create a Java Webapp with JSON, REST and UNIT Test RESTful Java Jersey JAX-RS Unit Test embedded Jetty Maven Webapp Download. DOWN...