Skip to content

docker: split off gitaly, gitlab-shell and ssh

Kevin Daudt requested to merge split-gitaly into 14.0-stable

Except for postgres and redis, the image is a monolithic image. This made it easier to build the image, because all components are linked to each-other. This MR starts the process of splitting out components, namely gitaly, and related, gitlab-shell together with openssh.

To make sure each component has the correct version, a script located at build/versions.sh will obtain the right versions of gitaly and gitlab-shell from gitlab. There is a task file that automates building of the docker images. One of the benefits is that it provides a way to use any file as an env file, something that docker-compose lacks. Only a the .env file it sources for environment variables that are usable as build arguments for docker images. Environment variables located in files specified by env_file directives are only usable as run-time variables for containers. So we can either use task, or we need to concatenate the build version environment variables to .env.

The gitaly and gitlab-shell images are built using docker multi-stage builds. This makes it easier to keep the final images clean, but also allows for parallel building of each stage. This can be achieved by using docker buildkit by setting DOCKER_BUILDKIT=1. By making sure each stage has dedicated files for building, changing files for one stage should not cause other stages to be rebuilt.

The different components communicate with each other through sockets, so volumes are used to mount the directories containing these sockets in the different images. gitlab-shell at the moment is used in both gitlab, gitally, was a container for openssh, so the files are copied from the gitlab-shell container into gitaly and gitlab-shell. In the future, this might no longer be necessary.

Edited by Kevin Daudt

Merge request reports