Last active
August 29, 2015 14:16
-
-
Save vizowl/5eb85d2d6ab2a6f463ac to your computer and use it in GitHub Desktop.
Makefiles that use container restarting to persist intermediates and targets
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
CID := .container | |
CONTAINER = $(shell cat $(CID) 2>/dev/null) | |
all: out.png | |
out.png: run/* | |
ifneq "$(CONTAINER)" "" | |
docker restart $(CONTAINER) | |
docker attach $(CONTAINER) || docker logs $(CONTAINER) | |
else | |
docker run --cidfile=$(CID) -w /work -v $$PWD/run:/work \ | |
ipython/scipystack make $(MFLAGS) | |
endif | |
docker cp $(CONTAINER):/output/out.png . | |
clean: | |
ifneq "$(CONTAINER)" "" | |
docker rm $(CONTAINER) | |
endif | |
rm -f out.png $(CID) |
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
/output/out.png: histogram.py image.jpg /output/.exists | |
python histogram.py | |
/output/.exists: | |
mkdir -p $(dir $@) | |
touch $@ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment