Image de la bannière : Build a legacy software with docker

Build a legacy software with docker

post thumb
by Cindy Piassale/ on 21 Jan 2020

Build a legacy software with docker

Following the rework of a legacy application in GWT for a client, we encountered problems during compilation. Indeed it required the installation of old libraries not available on the current environments of the developers.

The idea was therefore to provide a functional compilation solution on any environment :

  • developer workstation

  • client workstation

  • development / integration server

For that purpose we have decided to use docker. We created a docker image from a maven image, on which we downloaded the GWT libraries necessary for the compilation of the project.

Which gives the following Dockerfile :

::: formalpara-title :::

FROM maven:3.6-jdk-7

RUN curl | tar xjf -

Then we created a script to start the compilation :

::: formalpara-title :::

docker build -t mvn-gwt -f .
docker run \
  -v ~/.m2:/var/maven/.m2 \
  -v "$PWD":/usr/local/src/ \
  -w /usr/local/src/  \
  -ti --rm -u $(id -u) \
  -e MAVEN_CONFIG=/var/maven/.m2 \
  mvn-gwt \
  mvn -Duser.home=/var/maven -Dgoogle.webtoolkit.home=/var/gwt-linux-1.5.3 $1

From this script the compilation of the project can be started from any environment by simply running the command :

./ <target_maven>