Answers: <p>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.</p>
  <p>That is how to set up webhook.
  <a href="https://learn.microsoft.com/en-us/azure/devops/service-hooks/services/webhooks?view=azure-devops" rel="nofollow noreferrer">https://learn.microsoft.com/en-us/azure/devops/service-hooks/services/webhooks?view=azure-devops</a></p>
  <p>So flow is something like:</p>
  <ol>
  <li>create microservice on docker host</li>
  <li>create webhook on docker Azure repo</li>
  <li>2 URL will be 1 endpoint</li>
  </ol>
  <p>1 can be run as docker user, so you have permission to execute docker build and so on.</p>
  <p>I would do it this way.</p>
  
Answers: CC BY-SA 4.0
Answers: 2022-11-02T11:52:11.397Z
Answers: 2022-11-02T11:52:11.397Z
Answers: pregmatch
Answers: <p>Probably you can do the opposite, make github call the docker server.
  Use self hosted github runners.
  Configure and run the github agent on your server.
  An then create an action to do what you want on the docker server.
  That action can be auto fired for example with a commit or a merge,</p>
  
Answers: CC BY-SA 4.0
Answers: 2023-11-27T14:37:09.293Z
Answers: 2023-11-27T14:37:09.293Z
Answers: poiou
Body: <p>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.</p>
  <p>I have a git repo in Azure Devops that contains an Angular project (with a working dockerfile).</p>
  <p>I found that <a href="https://docs.docker.com/docker-hub/builds/" rel="nofollow noreferrer">Docker does have automatic builds</a> but it's a paid feature.
  <img src="https://i.sstatic.net/qADiW.png" alt="enter image description here" /></p>
  <p>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.</p>
  <p>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.</p>
  
Tags: <docker>
Title: Automatic builds based on commit and deploy
UserDisplayName: JensB
ThreadText: # Automatic builds based on commit and deploy
  
  (Asked by: username_0 on 2022-11-02)
  
  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 [Docker does have automatic builds](https://docs.docker.com/docker-hub/builds/) but it's a paid feature.
  ![enter image description here](https://i.sstatic.net/qADiW.png)
  
  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.
  
  **Tags:** docker
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2022-11-02. Score: 0
  
  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:
  
  1. create microservice on docker host
  2. create webhook on docker Azure repo
  3. 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.
  
  
  ---
  
  ### Answer by username_2 on 2023-11-27. Score: 0
  
  Probably you can do the opposite, make github call the docker server.
  Use self hosted github runners.
  Configure and run the github agent on your server.
  An then create an action to do what you want on the docker server.
  That action can be auto fired for example with a commit or a merge,
  
  
  ---
  
  