# ๐Ÿš€ Deploy to Docker (Swarm or Compose) Action Robustly deploy your Docker Compose files to Docker Swarm or regular Docker Compose environments via SSH. This action provides detailed debug output, secure SSH handling, validation, and automatic cleanup for a smooth, reliable deployment experience. --- ## โœจ Features - โœ… **Supports both Docker Swarm and Docker Compose** - ๐Ÿ”‘ **Secure SSH key handling** - ๐Ÿ” **Remote validation of Docker Compose files** - ๐Ÿงน **Automatic cleanup of temporary files** - ๐Ÿ“‹ **Detailed debug logs for easy troubleshooting** --- ## ๐Ÿ“ฅ Inputs | Input | Description | Required | Default | |--------------------|--------------------------------------------------|----------|---------| | `stack_name` | Docker stack or compose project name | โœ… Yes | - | | `ssh_host` | SSH host | โœ… Yes | - | | `ssh_user` | SSH username | โœ… Yes | - | | `ssh_key` | SSH private key | โœ… Yes | - | | `deploy_file` | Path to the processed deployment file | โœ… Yes | - | | `deploy_mode` | Deployment mode: `swarm` or `compose` | โŒ No | `swarm` | | `remote_temp_dir` | Remote temporary directory for deployment files | โŒ No | `/tmp` | --- ## ๐Ÿšฆ Deployment Modes This action supports two deployment modes: - **Docker Swarm (`swarm`)** ๐Ÿšข Deploys using `docker stack deploy`. - **Docker Compose (`compose`)** ๐Ÿณ Deploys using `docker compose up`. --- ## ๐Ÿ› ๏ธ Example Usage ### Deploying to Docker Swarm ๐Ÿšข ```yaml - name: Deploy to Docker Swarm ๐Ÿšข uses: your-org/deploy-to-docker-action@main with: stack_name: my-awesome-stack ssh_host: ${{ vars.SSH_HOST }} ssh_user: ${{ secrets.SSH_USER }} ssh_key: ${{ secrets.SSH_KEY }} deploy_file: docker-compose.processed.yml deploy_mode: swarm ``` ### Deploying with Docker Compose ๐Ÿณ ```yaml - name: Deploy using Docker Compose ๐Ÿณ uses: your-org/deploy-to-docker-action@main with: stack_name: my-compose-project ssh_host: ${{ vars.SSH_HOST }} ssh_user: ${{ secrets.SSH_USER }} ssh_key: ${{ secrets.SSH_KEY }} deploy_file: docker-compose.processed.yml deploy_mode: compose ``` --- ## ๐Ÿง‘โ€๐Ÿ’ป How It Works This action performs the following steps: 1. ๐Ÿ”‘ **Securely creates a temporary SSH key file** for authentication. 2. ๐Ÿ“ **Creates a secure temporary directory** on the remote host. 3. ๐Ÿ“ค **Copies your processed Docker Compose file** to the remote host. 4. ๐Ÿ” **Validates the Docker Compose file remotely** to ensure correctness. 5. ๐Ÿšข๐Ÿณ **Deploys your stack/project** based on the selected deployment mode. 6. ๐Ÿงน **Cleans up temporary files** both locally and remotely. --- ## ๐Ÿ“– Debugging & Logs During deployment, the action provides detailed debug logs at every step, making it easy to troubleshoot any issues: - โœ… SSH connection details - โœ… File transfer status - โœ… Validation results - โœ… Deployment status - โœ… Cleanup confirmation --- ## โš ๏ธ Requirements - SSH access to your Docker host. - Docker & Docker Compose installed on the remote host. - Proper permissions to deploy stacks or compose projects remotely. --- ## ๐Ÿ“œ License This action is open-source software licensed under the MIT license. --- ๐ŸŽ‰ **Happy Deploying!** ๐ŸŽ‰