Docker image with initialized local cache saves 50 seconds in startup

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Docker image with initialized local cache saves 50 seconds in startup

Tibor Digana
If you use Docker images with Maven with no mapping of cache to the
volumes, you may notice that Maven downloads the plugins for the build

This slows down the build because a lot of artifacts and plugins are
initially downloaded.
This takes 50 seconds which might be even longer than the productive build
itself (compiler, package, ...).

We discussed this topic with Herve and Karl at the Apache CON 2019 the last

Sometime the presentations were funny because the audience had to wait a
minute while the console was black where the Maven was downloading the
plugins in the background.
Nobody was sure what happened that time, whether the console hanged or the
Cloud server hanged, or another issue happened with the network.

I made a test and triggered the default lifecycle on Maven and I realized
that the cache was really very little, cca 12 MB.
So this little cache in the container would save 50 seconds which is the
improvement we are discussing.

From the use point of view, the user would use a new base image `
3.6.2-jdk-14-prefetched` which is my idea.

There are multiple technical solutions (range of plugins, extra pom,
internal Maven plugin versions, etc).

We understood that the best idea would be to have the image with the cache
in new Docker images produced by Carloss Sanchez.

We are discussing this topic in [1] but we do not have a consensus on who
will develop the Docker scripts and how.

We can continue here and we can propose a solution.