Docker has become the preferable way and the most easy way to run continuous integration, due to its reproducible nature and fast learning curve.
There are multiple ways approaching CI processes using docker.
Using docker build, which is the easiest way FROM node:12 ARG NODE_ENV=production COPY . /src RUN npm install WORKDIR /src CMD [ "node", "app.js" ] Using docker multi step build, this usually helps making the final image smaller and safer without all the build binaries FROM maven AS Builder COPY . /src RUN [ "mvn" , "clean" , "install" ] FROM openjdk:12-alpine WORKDIR /srv COPY --from=Builder /src/target ./srv/ CMD [ "java", "-jar", "app.jar" ] Using docker run with a pre-built build image on a volume mount this allows having cache directories and have some more functionality during the build, and will allow multiple commands docker run -v `$pwd`:/src -v `~/.m2`:/root/.m2 maven mvn clean install Using docker in docker, like gitlab, bitbucket etc…
This method is more complex than the rest and require you to mount docker socket to the as a volume to the docker container, and can be preformed in 2 ways: There is an official docker in docker image by docker inc that is tagged as docker:dind
...