-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
55 lines (37 loc) · 1.36 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
SOURCEDIR=.
PROJECT_NAME=hackzurich2019-be
PROJECT_ROOT=`git rev-parse --show-toplevel`
PROJECT_TOOL_PATH=/go/src/github.com/repa40x/$(PROJECT_NAME)
SWAGGER_VERSION=v0.20.1
SWAGGER_CMD=docker run --rm -it -v $(PROJECT_ROOT):$(PROJECT_TOOL_PATH) -w $(PROJECT_TOOL_PATH) quay.io/goswagger/swagger:$(SWAGGER_VERSION)
DOCKER_REPO=zrh.ocir.io/zrywfei8cmcr/hz2019/$(PROJECT_NAME)
VERSION=0.13
TAG=$(DOCKER_REPO):$(VERSION)
.DEFAULT_GOAL: validate
.PHONY: install-swagger validate vendor
install-swagger:
docker pull quay.io/goswagger/swagger:$(SWAGGER_VERSION)
validate:
$(SWAGGER_CMD) validate ./openapi/swagger.yaml
generate-full:
$(SWAGGER_CMD) generate server -A $(PROJECT_NAME) -f ./openapi/swagger.yaml --target ./generated
generate:
$(SWAGGER_CMD) generate server -A $(PROJECT_NAME) -f ./openapi/swagger.yaml --target ./generated --exclude-main
vendor:
go mod vendor
build:
go build
run:
godotenv -f ./local/.env ./hackzurich2019-be --scheme=http --host=0.0.0.0 --port=8080
docker-login:
docker login -u $(DOCKER_USER) -p $(DOCKER_TOKEN) $(DOCKER_URL)
docker-build:
docker build --pull -f ./deployment/Dockerfile -t $(TAG) .
docker-push:
docker push $(TAG)
docker-rm:
docker image rm $(TAG)
docker-run:
docker rm -f $(PROJECT_NAME) || true && docker run -dt --name $(PROJECT_NAME) --rm -p 8080:8080 $(TAG)
docker-stop:
docker rm -f $(PROJECT_NAME) || true