-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
52 lines (42 loc) · 1.57 KB
/
Makefile
File metadata and controls
52 lines (42 loc) · 1.57 KB
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
40
41
42
43
44
45
46
47
48
49
50
51
52
## From https://gist.github.com/mpneuried/0594963ad38e68917ef189b4e6a269db
# import config.
cnf ?= config.env
include $(cnf)
export $(shell sed 's/=.*//' $(cnf))
# grep the version from the mix file
VERSION=$(shell ./version.sh)
VERSION_MAJOR := $(shell echo $(VERSION) | cut -f1 -d.)
VERSION_MINOR := $(shell echo $(VERSION_MAJOR)).$(shell echo $(VERSION) | cut -f2 -d.)
VERSION_PATCH := $(shell echo $(VERSION_MINOR)).$(shell echo $(VERSION) | cut -f3 -d.)
# HELP
.PHONY: help
help: ## This help.
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)
.DEFAULT_GOAL := help
# DOCKER TASKS
build: ## Build the image
docker build \
--build-arg ARCH=$(ARCH) \
--build-arg VERSION=$(VERSION) \
-t $(DOCKER_REPO)/$(APP_NAME):latest \
-t $(DOCKER_REPO)/$(APP_NAME):$(VERSION_MAJOR) \
-t $(DOCKER_REPO)/$(APP_NAME):$(VERSION_MINOR) \
-t $(DOCKER_REPO)/$(APP_NAME):$(VERSION_PATCH) \
.
build-nc: ## Build the image without caching
docker build \
--no-cache \
--build-arg ARCH=$(ARCH) \
--build-arg VERSION=$(VERSION) \
-t $(DOCKER_REPO)/$(APP_NAME):latest \
-t $(DOCKER_REPO)/$(APP_NAME):$(VERSION_MAJOR) \
-t $(DOCKER_REPO)/$(APP_NAME):$(VERSION_MINOR) \
-t $(DOCKER_REPO)/$(APP_NAME):$(VERSION_PATCH) \
.
push: ## Push the images
docker push $(DOCKER_REPO)/$(APP_NAME):latest
docker push $(DOCKER_REPO)/$(APP_NAME):$(VERSION_MAJOR)
docker push $(DOCKER_REPO)/$(APP_NAME):$(VERSION_MINOR)
docker push $(DOCKER_REPO)/$(APP_NAME):$(VERSION_PATCH)
version: ## Output the current version
@echo $(VERSION)