Manage Docker Swarm and Docker Compose deployments with GitHub Actions

Image for post

Photo by Chris Sabor on Unsplash

There are plenty of continuous integration and delivery tools that can be used to run CI/CD pipelines, such as Jenkins, Travis CI, and CircleCI. When it comes to projects hosted on GitHub, there is another native option available, which is GitHub workflows.

GitHub workflows can be used to achieve several goals, such as building Docker images, running unit tests, and even deploying to a remote server. The workflows can be triggered by GitHub events as well as external events. For instance, it is possible to create a workflow that will be executed once you create a new release on the repository. In addition, the same workflow can be configured to be triggered by an external API call.

Because GitHub workflows can be triggered using native GitHub events and without defining webhooks, it is a much easier tool to use and define than other tools and options.

GitHub workflows are defined in YAML format files that describe which actions or steps need to be executed during the workflow. You can find more about the internals of GitHub workflows and GitHub actions in the article “Build GitHub Actions Using Docker Containers”.

Since GitHub’s actions can be used to replace other CI tools and provide an easy and straightforward way for defining CI tasks, I decided to use them for managing and defining CI/CD pipelines for my projects hosted on GitHub.

One of the pipelines that I wanted to build is a pipeline to deploy Docker services to a remote server using Docker commands. Unfortunately, I could not find any GitHub actions in the marketplace that could suit my needs and help me perform Docker deployments to remote servers. As a result, I decided to build my own GitHub action for deploying Docker services.

In this article, I will go step by step to explain the internals and details of the Github action that I built to manage docker service deployment.

#devops #docker-compose #continuous-deployment #docker #programming

Docker Deployments With GitHub Actions
9.95 GEEK