Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
53 lines (42 loc) · 1.61 KB
/
Copy pathMakefile
File metadata and controls
53 lines (42 loc) · 1.61 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
PROJECT?=github.com/nomad/front
APP?=front
PORT_CONTAINER?=80
PORT_APP?=80
HOST?=mvp.nomad.space
RELEASE?=0.3.0
COMMIT?=$(shell git rev-parse --short HEAD)
BUILD_TIME?=$(shell date -u '+%Y-%m-%d_%H:%M:%S')
CONTAINER_IMAGE?=nomadspace/${APP}
GOOS?=linux
GOARCH?=amd64
front_run:
npm run dev
clean:
rm -rf dist/*
build: clean
npm install && npm run build
container: build
docker build -t $(CONTAINER_IMAGE):$(RELEASE) .
push: container
docker push $(CONTAINER_IMAGE):$(RELEASE)
run:
docker stop $(CONTAINER_IMAGE):$(RELEASE) || true && docker rm $(CONTAINER_IMAGE):$(RELEASE) || true
docker run --name ${APP} -p ${PORT_CONTAINER}:${PORT_APP} --rm $(CONTAINER_IMAGE):$(RELEASE)
test:
go test -v -race ./...
minikube: push
for t in $$(find ./kubernetes -type f -name "*.yaml"); do \
cat $$t | \
sed -E "s/\{\{(\s*)\.Release(\s*)\}\}/$(RELEASE)/g" | \
sed -E "s/\{\{(\s*)\.ServiceName(\s*)\}\}/$(APP)/g" | \
sed -E "s/\{\{(\s*)\.ServicePort(\s*)\}\}/$(PORT_CONTAINER)/g" | \
sed -E "s/\{\{(\s*)\.ServiceHost(\s*)\}\}/$(HOST)/g" | \
sed -E "s/\{\{(\s*)\.AppPort(\s*)\}\}/$(PORT_APP)/g"; \
echo $$"\n"---; \
done > tmp.yaml;
kubectl apply -f tmp.yaml
minikube-update:
kubectl patch deployment ${APP} -p "{\"spec\":{\"template\":{\"metadata\":{\"annotations\":{\"date\":\"`date +'%s'`\"}}}}}"
#kubectl patch service ${APP} -p "{\"spec\":{\"template\":{\"metadata\":{\"annotations\":{\"date\":\"`date +'%s'`\"}}}}}"
kubectl apply -f tmp.yaml
#kubectl patch ingress ${APP} -p "{\"spec\":{\"template\":{\"metadata\":{\"annotations\":{\"date\":\"`date +'%s'`\"}}}}}"