Push Docker image on every tag push
Buddy is a CI/CD tool that helps developers automate delivery. For example, you can use Buddy to run unit tests whenever a new tag is pushed to the selected branch, dockerize the application, and then push the image to multiple Docker registries:
First, select the Git provider (GitHub, Bitbucket, GitLab, or private) and the repository from which Buddy will fetch the code:
The next step is adding a pipeline and setting it to run whenever a new tag is pushed to the repository. To do that, set the trigger mode to 'On push', select 'Tags by wildcard' as the branch, and customize the
refs/tags pattern that will trigger the pipeline. For example, setting the pattern to
refs/tags/v* will only deploy the tags starting with
v, such as
v2, and so on.
Now, add the action that will build an image from your Dockerfile:
Now it's time to add the 'Push Docker image' action that will release your application to the selected registry. As you can have several building actions in your pipeline, make sure to select the one that built the image that you want to push:
The next step is selecting the registry to which the image will be pushed. Buddy has a dedicated integration with Docker Hub, Amazon ECR and Google GCR, but you can use a private registry as well:
Finally, determine the URL to the image in the registry and the tag with which it will be pushed.
You can use the
$BUDDY_EXECUTION_TAG variable to automatically tag the images with the tags created in your repository. This is one of many environment variables you can use.