Makefile 873 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. all: build
  2. install: push
  3. .PHONY: rebuild build push start stop restart bash
  4. build: Dockerfile
  5. docker build --tag chsa/centos-tools:latest .
  6. rebuild: Dockerfile
  7. docker build --no-cache --tag chsa/centos-tools:latest .
  8. push: build
  9. docker push chsa/centos-tools:latest
  10. start: build
  11. if [ `docker ps | grep chsa/centos-tools | wc -l` -eq 0 ]; then \
  12. if [ `docker ps -a | grep centos-tools | wc -l` -gt 0 ]; then \
  13. echo "Removing the stalled copy..." ;\
  14. docker stop centos-tools ;\
  15. docker rm centos-tools ;\
  16. fi ;\
  17. docker run --name centos-tools -t -d chsa/centos-tools:latest ;\
  18. else \
  19. echo "Already running..." ;\
  20. fi
  21. stop:
  22. @if [ `docker ps | grep centos-tools | wc -l` -gt 0 ]; then \
  23. docker stop centos-tools ;\
  24. docker rm centos-tools ;\
  25. fi
  26. restart:
  27. make stop
  28. make start
  29. bash: build
  30. docker exec -it centos-tools /bin/bash