aboutsummaryrefslogtreecommitdiff
path: root/Makefile
blob: 2d5833eeb23bf99e334a227b169790135208261e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
.PHONY: build

CONTAINERNAME=thornycrackers_helloworld
IMAGENAME=thornycrackers/helloworld

help:
	@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'

build: ## Build the image
	docker build -t $(IMAGENAME) .

up: build ## Run the container
	docker run -dP --name $(CONTAINERNAME) $(IMAGENAME)

down: ## Stop the container
	docker stop $(CONTAINERNAME) 2> /dev/null || echo 'No container to stop'

clean: down ## Remove the container
	docker rm $(CONTAINERNAME) 2> /dev/null || echo 'No container to remove'

push: ## Push the container to dockerhub
	docker push $(IMAGENAME)