-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile
39 lines (29 loc) · 1.46 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
.PHONY: help version test erl shell build clean rebuild release
.NOTPARALLEL: build rebuild release
.DEFAULT_GOAL := help
VERSION ?= `cat VERSION`
MIN_VERSION := $(shell echo $(VERSION) | sed 's/\([0-9][0-9]*\)\.\([0-9][0-9]*\)\(\.[0-9][0-9]*\)*/\1.\2/')
IMAGE_NAME ?= beardedeagle/alpine-erlang-builder
help: ## Show this message
@echo "$(IMAGE_NAME):$(VERSION)"
@echo
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-15s\033[0m %s\n", $$1, $$2}'
version: ## Show Makefile version
@echo -e 'OTP/Erlang version: $(shell echo $(VERSION))'
@echo -e 'Maintainer: beardedeagle <[email protected]>'
@echo -e 'Last modified: 2020-11-05'
test: ## Test Docker image
@docker run --rm -it $(IMAGE_NAME):$(VERSION) erl -version
erl: ## Run erl shell in Docker image
@docker run --rm -it $(IMAGE_NAME):$(VERSION) erl
shell: ## Boot to shell prompt in Docker image
@docker run --rm -it $(IMAGE_NAME):$(VERSION) /bin/bash
build: ## Build Docker images
@docker build --force-rm -t $(IMAGE_NAME):$(VERSION) -t $(IMAGE_NAME):$(MIN_VERSION) -t $(IMAGE_NAME):latest .
clean: ## Clean up generated Docker images
@docker rmi --force $(IMAGE_NAME):$(VERSION) $(IMAGE_NAME):$(MIN_VERSION) $(IMAGE_NAME):latest
rebuild: clean build ## Rebuild Docker images
release: build ## Build and release Docker images to Docker Hub
@docker push $(IMAGE_NAME):$(VERSION)
@docker push $(IMAGE_NAME):$(MIN_VERSION)
@docker push $(IMAGE_NAME):latest