Skip to content

Instantly share code, notes, and snippets.

@MartinSchmidt123
Created November 5, 2017 11:14
Show Gist options
  • Save MartinSchmidt123/b3e230ad409746547031ab7556ed4e94 to your computer and use it in GitHub Desktop.
Save MartinSchmidt123/b3e230ad409746547031ab7556ed4e94 to your computer and use it in GitHub Desktop.
Makefile for common commands used with a docker swarm cluster
name=$(shell basename $(CURDIR))
ls = docker stack services ${name}
rm = docker stack rm ${name}
deploy = docker stack deploy -c docker-stack.yml ${name}
build = docker-compose -f docker-compose.yml build
logs = multitail $(shell docker stack services --format "{{.Name}}" ${name} | xargs -n1 sh -c 'echo -l \"docker service logs --raw -f $${@}\"\ ' "$${0}")
ls:
$(ls)
rm:
$(rm)
build:
$(build)
deploy:
$(deploy)
logs:
$(logs)
full:
$(rm)
$(deploy)
$(logs)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment