GitHub Action
Docker Stack Deploy
v1.0.0
Latest version
This action deploys a docker stack from a compose file to a remote docker host using SSH Password or Key File Authentication.
For more details see action.yaml and src/main.sh.
input | required | default | description |
---|---|---|---|
host | Yes | - | Remote Docker hostname |
port | No | 22 |
Remote Docker port |
user | Yes | - | Remote Docker username |
pass | No | - | Remote Docker password * |
ssh_key | No | - | Remote SSH Key file * |
file | No | docker-compose.yaml |
Docker Compose file |
name | Yes | - | Docker Stack name |
env_file | No | - | Docker Environment file |
pass/ssh_key - You must provide either a pass
or ssh_key
- name: 'Docker Stack Deploy'
uses: cssnr/stack-deploy-action@v1
with:
host: ${{ secrets.DOCKER_HOST }}
port: ${{ secrets.DOCKER_PORT }}
user: ${{ secrets.DOCKER_USER }}
pass: ${{ secrets.DOCKER_PASS }}
file: 'docker-compose-swarm.yaml'
name: 'stack-name'
Simple Example
name: 'Test Docker Stack Deploy'
on:
push:
jobs:
deploy:
name: 'Deploy'
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: 'Checkout'
uses: actions/checkout@v4
- name: 'Docker Stack Deploy'
uses: cssnr/stack-deploy-action@v1
with:
host: ${{ secrets.DOCKER_HOST }}
port: ${{ secrets.DOCKER_PORT }}
user: ${{ secrets.DOCKER_USER }}
pass: ${{ secrets.DOCKER_PASS }}
file: 'docker-compose-swarm.yaml'
name: 'stack-name'
Full Example
name: 'Test Docker Stack Deploy'
on:
workflow_dispatch:
inputs:
tags:
description: 'Tags: comma,separated'
required: true
default: 'latest'
env:
REGISTRY: 'ghcr.io'
jobs:
deploy:
name: 'Deploy'
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: 'Checkout'
uses: actions/checkout@v4
- name: 'Generate Tags'
id: tags
uses: smashedr/docker-tags-action@master
with:
images: '$${{ env.REGISTRY }}/${{ github.repository }}'
extra: ${{ inputs.tags }}
- name: 'Setup Buildx'
uses: docker/setup-buildx-action@v2
with:
platforms: linux/amd64,linux/arm64
- name: 'Docker Login'
uses: docker/login-action@v2
with:
registry: $${{ env.REGISTRY }}
username: ${{ secrets.GHCR_USER }}
password: ${{ secrets.GHCR_PASS }}
- name: 'Build and Push'
uses: docker/build-push-action@v4
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.tags.outputs.tags }}
- name: 'Docker Stack Deploy'
uses: cssnr/stack-deploy-action@v1
with:
host: ${{ secrets.DOCKER_HOST }}
port: ${{ secrets.DOCKER_PORT }}
user: ${{ secrets.DOCKER_USER }}
ssh_key: '${{ secrets.DOCKER_SSH_KEY }}'
file: 'docker-compose-swarm.yaml'
name: 'stack-name'
For general help or to request a feature see:
- Q&A Discussion: https://github.com/cssnr/stack-deploy-action/discussions/categories/q-a
- Request a Feature: https://github.com/cssnr/stack-deploy-action/discussions/categories/feature-requests
If you are experiencing an issue/bug or getting unexpected results you can:
- Report an Issue: https://github.com/cssnr/stack-deploy-action/issues
- Chat with us on Discord: https://discord.gg/wXy6m2X8wY
- Provide General Feedback: https://cssnr.github.io/feedback/
Currently, the best way to contribute to this project is to star this project on GitHub.
Additionally, you can support other GitHub Actions I have published:
- VirusTotal Action
- Update Version Tags Action
- Update JSON Value Action
- Parse Issue Form Action
- Mirror Repository Action
- Portainer Stack Deploy
- Mozilla Addon Update Action
For a full list of current projects to support visit: https://cssnr.github.io/