DEV Community

Discussion on: Dockerizing DevOps

Collapse
 
henrikstanley profile image
Henrik Stanley Mortensen

Great post Eliise.
One thing you could also do if you use a central repo for your dev image is to tell your ADO yaml pipeline to use the container as the environment to run everything from in a stage / job / step. That way you don't have to run a docker command at each step you want to execute, but simply to define the container as a resource at the start of the pipeline, mount in any relevant secrets and then just run the commands natively in the pipeline.

I have a sample repo showing this here if interested:
github.com/dfds/k8s-repo-template/...

Of cause this requires that your build machine can pull this from somewhere and doesn't have to build the container from a dockerfile at startup.
With both hosted and selfhosted agents you can use some level of caching for the docker file to save time not having to pull the build container down at every build.

Collapse
 
eliises profile image
Eliise • Edited

I am a bit late on my reply, but have you seen also that you can have a container target steps, not just jobs? https://docs.microsoft.com/en-us/azure/devops/pipelines/process/tasks?view=azure-devops&tabs=yaml#step-target

This allows you to actually build the image in a previous job and push it into an ACR and then pull it down on the step.

I've got an example here: dev.to/eliises/dockerizing-devops-...