forked from request-yo-racks/web
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
104 lines (77 loc) · 2.93 KB
/
Makefile
File metadata and controls
104 lines (77 loc) · 2.93 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# Project configuration.
PROJECT_NAME = web
# Makefile parameters.
RUN ?= local
SUFFIX ?=
TAG ?= $(shell git describe)$(SUFFIX)
# General.
SHELL = /bin/bash
TOPDIR = $(shell git rev-parse --show-toplevel)
# Docker.
DOCKERFILE = Dockerfile$(SUFFIX)
DOCKER_ORG = requestyoracks
DOCKER_REPO = $(DOCKER_ORG)/$(PROJECT_NAME)
DOCKER_IMG = $(DOCKER_REPO):$(TAG)
DOCKER_IMG_WEB_TOOLS = loannister/web-devtools:1.2.1
# Chart.
CHART_REPO = ryr
CHART_NAME = $(CHART_REPO)/$(PROJECT_NAME)
# Run commands.
DOCKER_RUN = docker run -t -v=$$(pwd):/code --rm
DOCKER_RUN_XVFB = $(DOCKER_RUN) --privileged $(DOCKER_IMG_WEB_TOOLS)
LOCAL_RUN_CMD =
# Determine whether running the command in a container or locally.
ifeq ($(RUN),docker)
RUN_CMD = $(DOCKER_RUN_XVFB)
else
RUN_CMD = $(LOCAL_RUN_CMD)
endif
default: setup
help: # Display help
@awk -F ':|##' \
'/^[^\t].+?:.*?##/ {\
printf "\033[36m%-30s\033[0m %s\n", $$1, $$NF \
}' $(MAKEFILE_LIST) | sort
bootstrap: bootstrap-osx bootstrap-npm ## Install software globally
bootstrap-npm: ## Install NPM packages globally
@bash tools/bootstrap-npm.sh
bootstrap-osx: ## Install software using Brew
@bash tools/bootstrap-osx.sh
build-docker: init-config ## Build the docker image
@docker build -t $(DOCKER_IMG) -f $(DOCKERFILE) .
ci: ci-linters ci-docs ci-tests ## Run all the CI tasks
ci-docs: ## Ensure the documentation builds
@echo "Not implemented yet."
ci-linters: ## Run the static analyzers
@find src -name '*.html' -print | xargs polymer lint --input
ci-tests: ## Run the unit tests
$(RUN_CMD) polymer test -l chrome,firefox
clean: clean-repo clean-minikube clean-docker ## Clean everything (!DESTRUCTIVE!)
clean-docker: ## Remove all docker artifacts for this project (!DESTRUCTIVE!)
@docker image rm -f $(shell docker image ls --filter reference='$(DOCKER_REPO)' -q) || true
clean-minikube: ## Remove minikube deployment (!DESTRUCTIVE!)
helm delete --kube-context minikube --purge $(PROJECT_NAME) || true
clean-repo: ## Remove unwanted files in project (!DESTRUCTIVE!)
cd $(TOPDIR) && git clean -ffdx && git reset --hard
deploy-minikube: ## Deploy the web project in a dev environemnt
helm upgrade $(PROJECT_NAME) $(CHART_NAME) \
--kube-context minikube \
--install \
-f charts/values.minikube.yaml \
--set image.tag=$(TAG)
deploy-prod: ## Deploy the web project in production
cd charts \
&& helm upgrade $(PROJECT_NAME) $(CHART_NAME) \
--kube-context gke_request-yo-racks-1499134244211_us-central1-a_ryr-prod \
--install \
-f values.prod.yaml \
--set image.tag=$(TAG)
dist: ## Package the application
polymer build --preset es6-bundled
docs: ## Build documentation
@echo "Not implemented yet."
init-config: ## Setup the initial configuration
@bash tools/config-js.sh
setup: init-config ## Setup the full environment (default)
polymer install
.PHONY: bootstrap build-docker ci ci-linters ci-docs ci-tests clean clean-docker clean-minikube clean-repo deploy-minikube dist docs init-config setup