Skip to content

Instantly share code, notes, and snippets.

@WoodProgrammer
Created February 6, 2018 23:27
Show Gist options
  • Select an option

  • Save WoodProgrammer/70a53744d3191beb00a0180efe857a5e to your computer and use it in GitHub Desktop.

Select an option

Save WoodProgrammer/70a53744d3191beb00a0180efe857a5e to your computer and use it in GitHub Desktop.
Auto Deploy Docker Swarm Stack
#!/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