So to elaborate on the idea from the comments:
The docker compose
binary is direcly woven together with the docker
command itself, essentially being an extension to it.
As I see it there are now two main options:
You setup a dedicated gitlab runner, that works with the normal shell executor. You then install docker on that machine and also setup the compose-cli according to this manual. Then you can start deploying with the compose command.
You create a docker image that gives you the docker compose
command. An example dockerfile could look like this:
FROM docker
RUN apk add curl
RUN apk add tar
RUN curl -L https://github.com/docker/compose-cli/releases/download/v1.0.6/docker-linux-amd64.tar.gz -O
RUN tar xzf docker-linux-amd64.tar.gz
RUN chmod +x docker/docker
RUN ln -s /usr/local/bin/docker /usr/bin/com.docker.cli
Now, the difficulty there is to manage to have the docker daemon available. However it should be possible with gitlabs dind workflow.
After starting the container with docker run --rm --privileged -it <containername> sh
the docker compose
command in my example would be available as ./docker compose
as I did not add the new docker binary to any path. However the docker daemon is not started.
Note: the resulting image from this Dockerfile is essentially only a modified Docker-in-Docker image. So it should work, but I was not able to test it.
Docker itself provides an image on their docker hub that offers docker-compose functionality. The Gitlab CI image tag would be "docker/compose"
https://hub.docker.com/r/docker/compose
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…