-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
36 lines (26 loc) · 856 Bytes
/
Makefile
File metadata and controls
36 lines (26 loc) · 856 Bytes
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
export GO111MODULE=on
export GOOS:=$(shell go env GOOS)
export GOARCH:=$(shell go env GOARCH)
export GOVERSION:=1.12
export PROJECT=stats-api
export DOCKER_IMAGE_NAME?=stats-api
export DOCKER_IMAGE_TAG?=$(shell git rev-parse --short HEAD)
export DOCKER_REPO?=cloudnativeid
all: build run
run: build
./bin/${PROJECT} --v=5 --logtostderr=true
test:
go test ./...
build-docker:
docker run -it -e GOOS=${GOOS} -e GOARCH=${GOARCH} -v $(shell pwd):/${PROJECT} -w /${PROJECT} golang:${GOVERSION} make build run
docker:
docker build -t "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME):$(DOCKER_IMAGE_TAG)" \
-f ./Dockerfile .
docker-publish:
docker push "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME):$(DOCKER_IMAGE_TAG)"
build: clean
go build -mod vendor -o bin/${PROJECT} .
generate:
(cd api && go run github.com/99designs/gqlgen)
clean:
sudo rm -f bin/${PROJECT}