-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
45 lines (36 loc) · 1.57 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
40
41
42
43
44
45
# Copyright (C) 2020 by the Georgia Tech Research Institute (GTRI)
# This software may be modified and distributed under the terms of
# the BSD 3-Clause license. See the LICENSE file for details.
.PHONY: help
APP_NAME ?= `grep 'app:' mix.exs | sed -e 's/\[//g' -e 's/ //g' -e 's/app://' -e 's/[:,]//g'`
APP_VSN ?= `grep 'version:' mix.exs | cut -d '"' -f2`
BUILD ?= `git rev-parse --short HEAD`
ifeq ($(ORG),)
ORG := "gtri"
endif
help:
@echo "$(APP_NAME):$(APP_VSN)-$(BUILD)"
@perl -nle'print $& if m{^[a-zA-Z_-]+:.*?## .*$$}' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
build: ## Build the Docker image
docker build --build-arg APP_NAME=$(APP_NAME) \
--build-arg APP_VSN=$(APP_VSN) \
-t $(ORG)/$(APP_NAME):$(APP_VSN)-$(BUILD) \
-t $(ORG)/$(APP_NAME):latest .
build-release: ## Build the release Docker image
docker build --build-arg APP_NAME=$(APP_NAME) \
--build-arg APP_VSN=$(APP_VSN) \
-t $(ORG)/$(APP_NAME):$(APP_VSN) \
-t $(ORG)/$(APP_NAME):latest .
run: ## Run the app in Docker
docker run \
-e LEI_CRITICAL_CONTRIBUTOR_LEVEL=1 \
--expose 4444 -p 4444:4444 \
--rm -d $(ORG)/$(APP_NAME):latest
publish-snapshot: ## Push the artifact out
echo $(DOCKER_PASSWORD) | docker login -u $(DOCKER_USERNAME) --password-stdin
docker push $(ORG)/$(APP_NAME):$(APP_VSN)-$(BUILD)
docker push $(ORG)/$(APP_NAME):latest
publish-release: ## Push the artifact out
echo $(DOCKER_PASSWORD) | docker login -u $(DOCKER_USERNAME) --password-stdin
docker push $(ORG)/$(APP_NAME):$(APP_VSN)
docker push $(ORG)/$(APP_NAME):latest