$ make docker target # This will run `make target` inside the container
$ make docker target target2 # This will run `make target target2` inside the container
Last active
April 20, 2017 22:29
-
-
Save sagikazarmark/2232c06b90f0f76212a1cafe8038530b to your computer and use it in GitHub Desktop.
Makefile with Docker support
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
DOCKER_IMAGE = your/image | |
.PHONY = target target2 docker | |
target: | |
# Do something here | |
target2: | |
# Do something here | |
docker: ## Execute commands inside a Docker container | |
docker run --rm -it -v $$PWD:/app -w /app $(DOCKER_IMAGE) make $(filter-out docker, $(MAKECMDGOALS)) | |
@printf "\033[36mExiting with non-zero status code to abort make. If you see this message your command successfully ran.\033[0m\n" | |
exit 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment