Skip to content

Instantly share code, notes, and snippets.

@HeahDude
Forked from B-Galati/Makefile
Created October 15, 2018 12:22
Show Gist options
  • Save HeahDude/a0c94c77071b56328622302e2ea52720 to your computer and use it in GitHub Desktop.
Save HeahDude/a0c94c77071b56328622302e2ea52720 to your computer and use it in GitHub Desktop.
Rebuild docker images only when they are modified
DOCKER_FILES=$(shell find ./docker/dev/ -type f -name '*')
.DEFAULT_GOAL := help
.PHONY: help
help:
@grep -E '(^[a-zA-Z_-]+:.*?##.*$$)|(^##)' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[32m%-30s\033[0m %s\n", $$1, $$2}' | sed -e 's/\[32m##/[33m/'
##
## Project setup
##---------------------------------------------------------------------------
.PHONY: start
start: build up
.PHONY: reset
reset: clear start
.PHONY: clear
clear:
rm docker-dev.lock
##
# Internal rules
##
.PHONY: build
build: docker-dev.lock
docker-dev.lock: $(DOCKER_FILES)
$(DOCKER_COMPOSE) pull --parallel --ignore-pull-failures
$(DOCKER_COMPOSE) build --pull --force-rm
touch docker-dev.lock
.PHONY: up
up:
$(DOCKER_COMPOSE) up -d --remove-orphans
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment