Hi!
I have slightly the same approach as Magnus: Docker + Docker Compose + Virtualenv
The difference is that the agent is not contained in the docker but it launch the commands using docker-compose allowing to have middleware started in dockers too.
My main use case is:
- mongo official docker
- elasticsearch official docker
- redis official docker
- a specific docker for the build/test environment with linkage on the previous ones and the workspace as volume
It allows me to write my tasks like that:
docker-compose run -T myapp mytask.sh
This will start all required services as dockers. The -T option is important because without you won't have any output.
This permit to have all agents configured the same way: just install docker, docker-compose and add the go user to the docker group.
It can handle any configuration.
The main caveat is permissions handling: docker runs as root so written files have the root:root permissions unless you create a go user with the same uid in your build/test docker.
This is why I have a git material dedicated to pipelines scripts and tooling. with a Dockerfile written like that:
# Extend the generic build dockerfile to add the go user
FROM myapp/build
# Use the same go user and group as the agent.
RUN groupadd -r -g 5000 go && useradd -r -g go -u 5000 -m go
USER go
--
Axel H.