Created
February 6, 2018 23:27
-
-
Save WoodProgrammer/70a53744d3191beb00a0180efe857a5e to your computer and use it in GitHub Desktop.
Auto Deploy Docker Swarm Stack
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| SWARM_STAT='' | |
| docker swarm init | |
| echo "Docker-Compose PATH " | |
| read compose_path | |
| echo "Service Name" | |
| read service_name | |
| if [ "$compose_path" == "" ]; then | |
| compose_path='.' | |
| else | |
| echo $compose_path | |
| fi | |
| echo "Registry Service Starting" | |
| docker service create --name registry --publish published=5000,target=5000 registry:2 | |
| echo "Docker Compose Services Creating ... " | |
| pushd $compose_path | |
| docker-compose up -d | |
| echo "Test is Finished to the Docker Compose .. " | |
| docker-compose down --volumes | |
| echo "Pushing to the Local Variables .. " | |
| docker-compose push | |
| popd | |
| echo "Service Stack is Deploying .." | |
| pushd $compose_path | |
| docker stack deploy --compose-file docker-compose.yml $service_name | |
| popd | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment