Created
May 27, 2015 15:32
-
-
Save vitaly/9351ad175dac36cc283e to your computer and use it in GitHub Desktop.
generic Make build target for building docker images
This file contains 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
# generic build rule | |
docker/build/%: docker/recipes/%/Dockerfile .dockerignore | |
@echo | |
@echo | |
@echo =================================== Building $@ | |
@echo | |
@echo | |
docker build --rm -t $* -f "$<" . | |
docker inspect --format="{{.Id}}" $* > $@ | |
@echo | |
@echo =================================== DONE: $@ `cat "$@"` | |
@echo | |
clean: | |
rm -v docker/build/* | |
.PHONY: clean | |
gc: | |
@docker ps --filter "status=exited" | grep -v data | grep -v ^CONTAINER | awk '{print $$1}' | xargs docker rm | |
.PHONY: gc | |
gci: | |
docker images -q --filter "dangling=true" | xargs docker rmi | |
.PHONY: gci% |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment