10
10
# Docker Stack Deploy Action
11
11
12
12
This 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.
13
14
14
15
For more details see [ action.yaml] ( action.yaml ) and [ src/main.sh] ( src/main.sh ) .
15
16
17
+ _ Portainer Users_ : You can deploy directly to Portainer with: [ cssnr/portainer-stack-deploy-action] ( https://github.com/cssnr/portainer-stack-deploy-action )
18
+
16
19
- [ Inputs] ( #Inputs )
17
20
- [ Examples] ( #Examples )
18
21
- [ Support] ( #Support )
19
22
- [ Contributing] ( #Contributing )
20
23
21
24
## Inputs
22
25
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 \* |
33
40
34
41
** pass/ssh_key** - You must provide either a ` pass ` or ` ssh_key `
35
42
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
+
36
49
``` yaml
37
50
- name : ' Docker Stack Deploy'
38
51
uses : cssnr/stack-deploy-action@v1
39
52
with :
53
+ name : ' stack-name'
54
+ file : ' docker-compose-swarm.yaml'
40
55
host : ${{ secrets.DOCKER_HOST }}
41
56
port : ${{ secrets.DOCKER_PORT }}
42
57
user : ${{ secrets.DOCKER_USER }}
43
58
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:
45
67
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 }}
46
76
` ` `
47
77
48
78
# # Examples
@@ -68,12 +98,12 @@ jobs:
68
98
- name: 'Docker Stack Deploy'
69
99
uses: cssnr/stack-deploy-action@v1
70
100
with:
101
+ name: 'stack-name'
102
+ file: 'docker-compose-swarm.yaml'
71
103
host: ${{ secrets.DOCKER_HOST }}
72
104
port: ${{ secrets.DOCKER_PORT }}
73
105
user: ${{ secrets.DOCKER_USER }}
74
106
pass: ${{ secrets.DOCKER_PASS }}
75
- file : ' docker-compose-swarm.yaml'
76
- name : ' stack-name'
77
107
` ` `
78
108
79
109
Full Example
@@ -115,14 +145,14 @@ jobs:
115
145
platforms: linux/amd64,linux/arm64
116
146
117
147
- name: 'Docker Login'
118
- uses : docker/login-action@v2
148
+ uses: docker/login-action@v3
119
149
with:
120
150
registry: $${{ env.REGISTRY }}
121
151
username: ${{ secrets.GHCR_USER }}
122
152
password: ${{ secrets.GHCR_PASS }}
123
153
124
154
- name: 'Build and Push'
125
- uses : docker/build-push-action@v4
155
+ uses: docker/build-push-action@v6
126
156
with:
127
157
context: .
128
158
platforms: linux/amd64,linux/arm64
@@ -132,12 +162,12 @@ jobs:
132
162
- name: 'Docker Stack Deploy'
133
163
uses: cssnr/stack-deploy-action@v1
134
164
with:
165
+ name: 'stack-name'
166
+ file: 'docker-compose-swarm.yaml'
135
167
host: ${{ secrets.DOCKER_HOST }}
136
168
port: ${{ secrets.DOCKER_PORT }}
137
169
user: ${{ secrets.DOCKER_USER }}
138
170
ssh_key: '${{ secrets.DOCKER_SSH_KEY }}'
139
- file : ' docker-compose-swarm.yaml'
140
- name : ' stack-name'
141
171
` ` `
142
172
143
173
# Support
@@ -165,6 +195,7 @@ Additionally, you can support other GitHub Actions I have published:
165
195
- [Update JSON Value Action](https://github.com/cssnr/update-json-value-action)
166
196
- [Parse Issue Form Action](https://github.com/cssnr/parse-issue-form-action)
167
197
- [Mirror Repository Action](https://github.com/cssnr/mirror-repository-action)
198
+ - [Stack Deploy Action](https://github.com/cssnr/stack-deploy-action)
168
199
- [Portainer Stack Deploy](https://github.com/cssnr/portainer-stack-deploy-action)
169
200
- [Mozilla Addon Update Action](https://github.com/cssnr/mozilla-addon-update-action)
170
201
0 commit comments