A GitHub Action that supports docker-compose and Docker Swarm deployments on a remote host using SSH.
The Action is adapted from work by wshihadeh and TapTap21
Below is a brief example on how the action can be used:
- name: Deploy to Docker swarm
uses: sulthonzh/docker-remote-deployment-action@v1
with:
remote_docker_host: user@host
ssh_private_key: ${{ secrets.SSH_PRIVATE_KEY }}
ssh_public_key: ${{ secrets.SSH_PUBLIC_KEY }}
deployment_mode: docker-swarm
copy_stack_file: true
deploy_path: /root/my-deployment
stack_file_name: docker-compose.yaml
keep_files: 5
args: my_applicaion
Remote Docker host ie (user@host).
Remote Docker ssh port ie (22).
Remote Docker SSH public key eg (~/.ssh/rsa_id.pub).
SSH private key used to connect to the docker host eg (~/.ssh/rsa_id).
Deployment command args.
Deployment mode either docker-swarm or docker-compose. Default is docker-compose.
Copy stack file to remote server and deploy from the server. Default is false.
The path where the stack files will be copied to. Default ~/docker-deployment.
Docker stack file used. Default is docker-compose.yml.
Number of the files to be kept on the server. Default is 3.
A boolean input to trigger docker prune command. Default is false.
The args for the pre deploument command.
Pull docker images before deploying. Default is false.
The docker registry username.
The docker registry password.
The docker registry URI. Default is https://registry.hub.docker.com.