How to create a custom Docker image with JDK8, Maven and Gradle
Nowadays working on projects where different environments need to be handle (different technologies, languages, build automation system…) is a common situation for developers and engineers.
Recently I have been involved in a project that requires building 2 different types of java plugins. The first type was maven based projects, and the second one makes use of gradle. That situation forced us to maintain two different development environments, which provoked that classic "it worked in my machine" problem.
After analysing the problem, we decided to use gitlab for our Continuous Integration pipeline, in such a way that, the test/build and deployment stages could run on 2 different docker images (one with maven and the other one with gradle). That solved most of the integration problems, but still, we didn't use only one environment (one docker image) for all plugins within the project. In consequence we decided to create our own custom docker image, containing all the components needed to develop all our plugins.
Environment
This step by step tutorial is written based on the following requirements:
- Operating System: Mac OS Sierra 10.12.6
- Docker Community: v.18.09.2 for Mac (how to install docker)