Skip to content

improve build and deployment speed

Siavash Sefid-Rodi edited this page Mar 1, 2018 · 1 revision

improve deployment speed

It takes around three minutes to build and deploy netlify in GitLab with their shared runners. This means your website is updated around three minutes after pushing to GitLab. You might have noticed that docker is able to use a cache for image layers that did not changed. This caching can speed the build vastly. GitLabs ahred runner do not use this cacheing, but you can run a private runner on your server. The build and deployment time is reduced to 1 minute (small digital ocean machine). You can create a runner configuration interactively by

dind-machine ssh myserver docker run -i -v /srv/gitlab-runner/config:/etc/gitlab-runner gitlab/gitlab-runner register

This creates the file /srv/gitlab-runner/config/config.toml. Since docker in docker is used for the creation of the docker images, we must change this file. Open a ssh shell on your server with

dind-machine ssh myserver

and open the file with vim

vim /srv/gitlab-runner/config/config.toml

Change the keys priviliged and volumes to the following values

privileged = true
volumes = ["/cache", "/var/run/docker.sock:/var/run/docker.sock"]

and start your private gitlab runner with

dind-machine ssh myserver docker run --rm -d --name gitlab-runner -v /var/run/docker.sock:/var/run/docker.sock -v /srv/gitlab-runner/config:/etc/gitlab-runner gitlab/gitlab-runner:latest

Clone this wiki locally