Reputation: 65
I have a github-repository, that is linked to automated build on Docker. Consequently, on each commit to master-branch, docker triggers building of Docker-image.
Also, each commit is tested by Travis CI automatically.
My question is: is there any way to trigger Docker only if travis finishes successfully? Do I need some sort of webhook or something like that for my goal?
Upvotes: 2
Views: 161
Reputation: 8781
You could trigger the Travis CI test after the repository is pushed. Then, in the deploy step you could trigger a build on Docker. Or even do the build inside Travis, and just push the image to the repository you are using.
Travis has a nice overview of how to make this flow happen here.
The gist is that you're going to need to have sudo: required
, so you're going to be running in a VM instead of inside Docker, as is the standard way in Travis. You also need to add docker
as a service, much like you'd add redis
or postgres
for an integration test. The Pushing Docker Image to a Registry section has a lot of info on setting things up for the actual deployment. I'd use an actual deploy
step with the script
provider, rather than after_success
, but that's up to you.
Upvotes: 2