Bash tool for Docker Compose that does Continous Deployment (DCCD)
I run a small Kubernetes cluster at home where I use Renovate for dependency management and Flux for continuous deployment. Flux has spoiled me, but I've found nothing like it for my small Docker Compose setup (the stuff that isn't on K8s yet).
DCCD is a bash script that is meant to run via crontab. It checks the specified repo and branch for changes, compares the commits on the remote and local repos, and if necessary, updates the local repo and redeploys your Docker Compose applications.
You'll obviously need to have git
and docker compose
installed.
Docker Compose files will need to be named docker-compose.yml
or docker-compose.yaml
.
The script will redeploy all Docker Compose files if it finds the remote repo has changed (not just the individual files that have changed). Git is the source of truth.
The script is meant to run via crontab. The example below runs every 30th minute (i.e., XX:00 and XX:30).
*/30 * * * * /path/to/dccd.sh -b master -d /path/to/git_repo -l /tmp/dccd.txt -p -x ignore_this_directory
Usage examples are below.
Usage: ./dccd.sh [OPTIONS]
Options:
-b <name> Specify the remote branch to track (default: main)
-d <path> Specify the base directory of the git repository (required)
-h Show this help message
-l <path> Specify the path to the log file (default: /tmp/dccd.log)
-p Specify if you want to prune docker images (default: don't prune)
-x <path> Exclude directories matching the specified pattern (relative to the base directory)
Example: /path/to/dccd.sh -b master -d /path/to/git_repo -l /tmp/dccd.txt -p -x ignore_this_directory
- What about Portainer? Portainer Business Edition does gitops, but I'm trying to remove my dependency on Portainer.
- What about Watchtower? Watchtower only works if the image tag is
latest
, and it checks for updates against a container image repo directly (e.g., DockerHub), not against Docker Compose files in a git repo. - What about Harbormaster? This comes close, but Harbormaster needs a specific configuration and the directory structure of the Docker Compose files has to be setup a specific way.