DEV Community


Discussion on: A free CI (using Docker-Compose) for your Gitlab repositories?

mr_nil profile image
Stephen Moretti

So yes, with a before script, you will build on each job. However, your before is simply that you are building a php container. For that you can probably reuse an existing php docker image from docker hub, rather than build each time. When you apply that to your jobs rather than as a before script gitlab will cache the image and reuse rather than pull each time.

You can also do things with passing artefacts between jobs.

Separating your tasks into jobs and stages means that when you look at your pipeline you can see which job is currently running and which has actually failed without having to dig into the console output to work out what died.

If you want to go nuts, you can actually build containers in a repo in a pipeline, do some assurance and setting on your container, and stash the built image in the image registry in the repo for reuse in other pipelines.