Currently, we use Fabric8 plugin to build and push Docker images.
The thing is, that this plugin utilizes Maven to build the project and Docker to push the images.
The command looks like this: “mvn clean package docker:build docker:push”.
We use Gitlab Ci to run our Maven builds, but the real goal is to get use of Fabric8 plugin within the .gitlab-ci.yml.
An attempt to just add the above command to .gitlab-ci.yml script section failed.
And the reason why is known: you need to use a correct image.
For example: if I use doker:stable image in .gitlab-ci.yml, I receive “/bin/sh: eval: line 80: mvn: not found”, and if I use image: maven:3-jdk-8, I receive
“/bin/sh: eval: line 80: docker: not found”.
Does the image, which combines Docker and Maven binaries, even exists?
Or, maybe, we just approaching the problem from the wrong end?
Also, it’s worth to mention, that I configured my runner as Docker from Docker by mounting corresponding volume (–docker-volumes /var/run/docker.sock:/var/run/docker.sock) to give access to the hosts’ socket.
Thanks in advance!
Attaching our .gitlab-ci.yml.
- Maven build
stage: Maven build
- cd ./config-service
- mvn clean package docker:build docker:push