This repository has been archived by the owner on Mar 10, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Makefile
50 lines (41 loc) · 2.7 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
46
47
48
49
50
# ╔════════════════════════════════════════════════════════════════════════════╗
# ║ ║
# ║ \ | | _|_) | ║
# ║ |\/ | _` | | / _ \ | | | _ \ ║
# ║ | | ( | < __/ __| | | __/ ║
# ║ _| _|\__,_|_|\_\\___|_| _|_|\___| ║
# ║ ║
# ║ * github.com/paperwork * twitter.com/paperworkcloud * ║
# ║ ║
# ╚════════════════════════════════════════════════════════════════════════════╝
.PHONY: help build run local-build local-build-develop local-run local-run-develop
APP_NAME ?= "web" ##@Variables The service name
APP_VSN ?= `grep '"version":' package.json | sed 's/.*"\([0-9]*\.[0-9]\.[0-9]*\)".*/\1/'` ##@Variables The service version
BUILD ?= `git rev-parse --short HEAD` ##@Variables The build hash
FN_HELP = \
%help; while(<>){push@{$$help{$$2//'options'}},[$$1,$$3] \
if/^([\w-]+)\s*(?:).*\#\#(?:@(\w+))?\s(.*)$$/}; \
print"$$_:\n", map" $$_->[0]".(" "x(20-length($$_->[0])))."$$_->[1]\n",\
@{$$help{$$_}},"\n" for keys %help; \
help: ##@Miscellaneous Show this help
@echo "Usage: make [target] <var> ...\n"
@echo "$(strip $(APP_NAME)):$(strip $(APP_VSN))-$(strip $(BUILD))"
@perl -e '$(FN_HELP)' $(MAKEFILE_LIST)
build: ##@Docker Build service
docker build --build-arg APP_NAME="$(strip $(APP_NAME))" \
--build-arg APP_VSN="$(strip $(APP_VSN))" \
-t "$(strip $(APP_NAME)):$(strip $(APP_VSN))-$(strip $(BUILD))" \
-t "$(strip $(APP_NAME)):latest" .
run: ##@Docker Run service locally
docker run --env-file config/docker.env \
--rm -it "$(strip $(APP_NAME)):latest"
local-build-develop: ##@Local Build service (target: dev) locally
yarn install
./node_modules/@angular/cli/bin/ng build
local-build: ##@Local Build service (target: prod) locally
yarn install
./node_modules/@angular/cli/bin/ng build --prod
local-run-develop: ##@Local Run service (target: dev) locally
./node_modules/@angular/cli/bin/ng serve --disable-host-check
local-run: ##@Local Run service (target: prod) locally
./node_modules/@angular/cli/bin/ng serve --disable-host-check --prod