Automatic builds based on commit and deploy
-
I am trying to figure out how to get my Ubuntu docker server to react to code commits on a git-repo and build and deploy an image based on that.
I have a git repo in Azure Devops that contains an Angular project (with a working dockerfile).
I found that https://docs.docker.com/docker-hub/builds/ but it's a paid feature.
I have previously created build pipelines in Azure which work well (albeight very slowly), I am wondering if it is possible to get my Ubuntu VPS Docker host to react to git commits on the main branch and pull the latest code and build the docker image and replace it on the (local) server.
Just to be clear, I want to do all this on my own VPS. Any guides or hints to keywords that I should be looking for are much appreciated.
-
As far as I can see, you can only use Webhook on an actual repository that will call some service on your docker host. Docker host must be aware somehow.
That is how to set up webhook. https://learn.microsoft.com/en-us/azure/devops/service-hooks/services/webhooks?view=azure-devops
So flow is something like:
- create microservice on docker host
- create webhook on docker Azure repo
- 2 URL will be 1 endpoint
1 can be run as docker user, so you have permission to execute docker build and so on.
I would do it this way.