-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
59 lines (45 loc) · 1.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
51
52
53
54
55
56
57
58
59
.ONESHELL:
SHELL := /bin/bash
.PHONY: help deps run dist docker-* infra-*
REVISION ?= $(shell git describe --tags --always)
IMAGE ?= http-echo:$(REVISION)
help: ## Show this help list
@ grep -E '^[a-z.A-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) \
| awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
node_modules:
npm install
deps: node_modules ## Install dependencies
build: dist ## Build typescript
npm run build
run: dist/index.js ## Run local node server
node dist/index.js
dist: ## Build docker image
ifeq ($(shell docker images --quiet $(IMAGE)),)
docker build --tag $(IMAGE) .
endif
@echo "Image with tag $(REVISION) is already built"
docker-run: dist ## Run container locally
docker run --name=http-echo \
--detach --publish=8080:3000 \
$(IMAGE)
docker logs --follow http-echo
docker-stop: ## Stop and remove local container
docker kill http-echo
docker rm http-echo
infra-seed-ci-user: ## Generate PowerUser in AWS account and get it's access key to set in CI secrets
aws --no-cli-pager iam create-user --user-name github
aws --no-cli-pager iam attach-user-policy --user-name github \
--policy-arn arn:aws:iam::aws:policy/PowerUserAccess
aws iam create-access-key --user-name github \
--query 'AccessKey.{AccessKeyId:AccessKeyId,SecretAccessKey:SecretAccessKey}'
terraform/.terraform:
cd terraform
terraform init
infra-up: terraform/.terraform ## Provision infrastructure resources
cd terraform
terraform apply -auto-approve
infra-down: terraform/.terraform ## Tear down infrastructure
cd terraform
terraform apply -destroy
infra-kubeconfig: ## Add auth data to kubeconfig allowing access to EKS cluster
aws eks update-kubeconfig --region eu-west-2 --name green