A GitHub Action making GitOps with the simplicity of docker-compose possible, using SSH or optionally Tailscale SSH, with support for docker swarm, uploading directory for bind mounts and other features!
The Action is adapted from work by TapTap21 and wshihadeh
Here is an example of how to use the action
- name: Tailscale
uses: tailscale/github-action@ce41a99162202a647a4b24c30c558a567b926709
with:
authkey: ${{ secrets.TAILSCALE_AUTHKEY }}
hostname: Github-actions
- name: Start Deployment
uses: FarisZR/docker-compose-gitops-action@v1
with:
remote_docker_host: root@100.107.201.124
tailscale_ssh: true # no need for manual private and public keys
compose_file_path: postgres/docker-compose.yml
upload_directory: true # upload docker directory
docker_compose_directory: postgres # directory to upload
docker_login_password: ${{ secrets.DOCKER_REPO_PASSWORD }}
docker_login_user: ${{ secrets.DOCKER_REPO_USERNAME }}
docker_login_registry : ${{ steps.login-ecr.outputs.registry }}
args: -p postgres up -dargs- Docker compose/stack command arguments. Example:-p app_stack_name -d uprequiredremote_docker_hostSpecify Remote Docker host. The input value must be in the following format (user@host) requiredtailscale_sshEnables Tailscale ssh mode, which uses managed ssh keys from Tailscale, and skips the private and public keys. default: falsessh_public_keyRemote Docker SSH public key. Required when Tailscale ssh isn't enabledssh_private_keySSH private key used in PEM format to connect to the docker host. Required when Tailscale ssh isn't enabledssh_portThe SSH port to be used. Default is 22.compose_file_pathDocker compose file path. Default isdocker-compose.yml(repo root), sub-directory Example:caddy/docker-compose.ymlupload_directoryUploads docker compose directory, useful for extra files like Configs. Optionaldocker_compose_directorySpecifies which directory in the repository to upload, needed for upload_directorypost_upload_commandOptional input to execute a command post upload, whenupload_directoryis enabled. Useful for things like changing permissions before starting containers.docker_swarmUses docker swarm instead of compose by using the docker stack command, default: falsedocker_login_userThe username for the container repository user. (DockerHub, ECR, etc.). Optional.docker_login_passwordThe password for the container repository user.docker_login_registryThe docker container registry to authenticate against Optional
This project is licensed under the MIT license. See the LICENSE file for details.