How to create a custom Docker image with JDK8, Maven and Gradle

Miguel Doctor Yuste
6 min readMay 23, 2019

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:

--

--

Miguel Doctor Yuste
Miguel Doctor Yuste

Written by Miguel Doctor Yuste

Ph.D, AI Data Scientist, Software Engineer, Cloud Architect, Systems Engineer, happy father and happy husband :)

Responses (3)