1010# Docker Stack Deploy Action
1111
1212This action deploys a docker stack from a compose file to a remote docker host using SSH Password or Key File Authentication.
13+ You can also optionally authenticate against a private registry using a username and password.
1314
1415For more details see [ action.yaml] ( action.yaml ) and [ src/main.sh] ( src/main.sh ) .
1516
17+ _ Portainer Users_ : You can deploy directly to Portainer with: [ cssnr/portainer-stack-deploy-action] ( https://github.com/cssnr/portainer-stack-deploy-action )
18+
1619- [ Inputs] ( #Inputs )
1720- [ Examples] ( #Examples )
1821- [ Support] ( #Support )
1922- [ Contributing] ( #Contributing )
2023
2124## Inputs
2225
23- | input | required | default | description |
24- | -------- | -------- | --------------------- | ------------------------- |
25- | host | ** Yes** | - | Remote Docker hostname |
26- | port | No | ` 22 ` | Remote Docker port |
27- | user | ** Yes** | - | Remote Docker username |
28- | pass | No | - | Remote Docker password \* |
29- | ssh_key | No | - | Remote SSH Key file \* |
30- | file | No | ` docker-compose.yaml ` | Docker Compose file |
31- | name | ** Yes** | - | Docker Stack name |
32- | env_file | No | - | Docker Environment file |
26+ | input | required | default | description |
27+ | ------------- | ---------------- | --------------------- | --------------------------------- |
28+ | host | ** Yes** | - | Remote Docker hostname |
29+ | port | No | ` 22 ` | Remote Docker port |
30+ | user | ** Yes** | - | Remote Docker username |
31+ | pass | Not w/ ` ssh_key ` | - | Remote Docker password \* |
32+ | ssh_key | Not w/ ` pass ` | - | Remote SSH Key file \* |
33+ | file | No | ` docker-compose.yaml ` | Docker Compose file |
34+ | name | ** Yes** | - | Docker Stack name |
35+ | env_file | No | - | Docker Environment file |
36+ | registry_auth | No | - | Enable Registry Authentication \* |
37+ | registry_host | No | - | Registry Authentication Host \* |
38+ | registry_user | No | - | Registry Authentication User \* |
39+ | registry_pass | No | - | Registry Authentication Pass \* |
3340
3441** pass/ssh_key** - You must provide either a ` pass ` or ` ssh_key `
3542
43+ ** registry_auth** - Set to ` true ` to deploy with ` --with-registry-auth `
44+
45+ ** registry_host** - To run ` docker login ` on another registry, example: ` ghcr.io `
46+
47+ ** registry_user/registry_pass** - Required to run ` docker login ` before stack deploy
48+
3649``` yaml
3750- name : ' Docker Stack Deploy'
3851 uses : cssnr/stack-deploy-action@v1
3952 with :
53+ name : ' stack-name'
54+ file : ' docker-compose-swarm.yaml'
4055 host : ${{ secrets.DOCKER_HOST }}
4156 port : ${{ secrets.DOCKER_PORT }}
4257 user : ${{ secrets.DOCKER_USER }}
4358 pass : ${{ secrets.DOCKER_PASS }}
44- file : ' docker-compose-swarm.yaml'
59+ ` ` `
60+
61+ Use ` docker login` and enable `--with-registry-auth`
62+
63+ ` ` ` yaml
64+ - name: 'Docker Stack Deploy'
65+ uses: cssnr/stack-deploy-action@v1
66+ with:
4567 name: 'stack-name'
68+ file: 'docker-compose-swarm.yaml'
69+ host: ${{ secrets.DOCKER_HOST }}
70+ port: ${{ secrets.DOCKER_PORT }}
71+ user: ${{ secrets.DOCKER_USER }}
72+ pass: ${{ secrets.DOCKER_PASS }}
73+ registry_host: 'ghcr.io'
74+ registry_user: ${{ vars.GHCR_USER }}
75+ registry_pass: ${{ secrets.GHCR_PASS }}
4676` ` `
4777
4878# # Examples
@@ -68,12 +98,12 @@ jobs:
6898 - name: 'Docker Stack Deploy'
6999 uses: cssnr/stack-deploy-action@v1
70100 with:
101+ name: 'stack-name'
102+ file: 'docker-compose-swarm.yaml'
71103 host: ${{ secrets.DOCKER_HOST }}
72104 port: ${{ secrets.DOCKER_PORT }}
73105 user: ${{ secrets.DOCKER_USER }}
74106 pass: ${{ secrets.DOCKER_PASS }}
75- file : ' docker-compose-swarm.yaml'
76- name : ' stack-name'
77107` ` `
78108
79109Full Example
@@ -115,14 +145,14 @@ jobs:
115145 platforms: linux/amd64,linux/arm64
116146
117147 - name: 'Docker Login'
118- uses : docker/login-action@v2
148+ uses: docker/login-action@v3
119149 with:
120150 registry: $${{ env.REGISTRY }}
121151 username: ${{ secrets.GHCR_USER }}
122152 password: ${{ secrets.GHCR_PASS }}
123153
124154 - name: 'Build and Push'
125- uses : docker/build-push-action@v4
155+ uses: docker/build-push-action@v6
126156 with:
127157 context: .
128158 platforms: linux/amd64,linux/arm64
@@ -132,12 +162,12 @@ jobs:
132162 - name: 'Docker Stack Deploy'
133163 uses: cssnr/stack-deploy-action@v1
134164 with:
165+ name: 'stack-name'
166+ file: 'docker-compose-swarm.yaml'
135167 host: ${{ secrets.DOCKER_HOST }}
136168 port: ${{ secrets.DOCKER_PORT }}
137169 user: ${{ secrets.DOCKER_USER }}
138170 ssh_key: '${{ secrets.DOCKER_SSH_KEY }}'
139- file : ' docker-compose-swarm.yaml'
140- name : ' stack-name'
141171` ` `
142172
143173# Support
@@ -165,6 +195,7 @@ Additionally, you can support other GitHub Actions I have published:
165195- [Update JSON Value Action](https://github.com/cssnr/update-json-value-action)
166196- [Parse Issue Form Action](https://github.com/cssnr/parse-issue-form-action)
167197- [Mirror Repository Action](https://github.com/cssnr/mirror-repository-action)
198+ - [Stack Deploy Action](https://github.com/cssnr/stack-deploy-action)
168199- [Portainer Stack Deploy](https://github.com/cssnr/portainer-stack-deploy-action)
169200- [Mozilla Addon Update Action](https://github.com/cssnr/mozilla-addon-update-action)
170201
0 commit comments