-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
51 lines (40 loc) · 1.07 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
SERVICE := roastbeef-swag
NAME := ghcr.io/maribowman/$(SERVICE)
GIT_BRANCH := $(shell git rev-parse --abbrev-ref HEAD)
GIT_HASH := $(shell git rev-parse --short HEAD)
TAG := $(GIT_BRANCH)-$(GIT_HASH)
IMAGE := $(NAME):$(TAG)
STAGE := local
### docker
.PHONY: build
build:
@echo starting build...
@docker build -q -t $(IMAGE) -t $(NAME):latest .
@docker image prune -f --filter label=stage=builder >/dev/null
push: build
@echo pushing images...
@docker push $(IMAGE)
@docker push $(NAME):latest
.PHONE: deploy
deploy: push
@echo triggering deployment...
@cd helm && helm upgrade --install $(SERVICE) --values ./values.yaml . --namespace default
.PHONY: service
service: build
@docker run -d --rm --network=host --name $(SERVICE)_$(TAG) $(NAME):latest > /dev/null
stop:
@docker stop $$(docker ps -q) > /dev/null
### testing
.PHONY: run
run:
@go run .
.PHONY: tests
tests:
@go test -race ./...
cover:
@go test -cover ./...
smoke: build
@docker run -d --rm -p 8800:8800 --name test-runner $(IMAGE) .
@bash ./test/smoke.sh
@docker stop test-runner
@docker rmi $(IMAGE)