-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
49 lines (38 loc) · 1.18 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
# Image URL to use all building/pushing image targets
SHELL := /bin/bash
APP_NAME ?= awi-infra-guard
BIN_NAME ?= ${APP_NAME}
OS ?= $(if $(GOOS),$(GOOS),$(shell go env GOOS))
ARCH ?= $(if $(GOARCH),$(GOARCH),$(shell go env GOARCH))
IMG ?= {CONTAINER_IMAGE}
.PHONY: all
all: generate mocks
.PHONY: generate
generate:
cd grpc && rm -rf go/infrapb/* js/* ts/*
cd grpc && protoc --proto_path=proto \
--go_out=go/infrapb --go_opt=paths=source_relative \
--go-grpc_out=go/infrapb --go-grpc_opt=paths=source_relative \
--js_out=import_style=commonjs:js --grpc-web_out=import_style=commonjs,mode=grpcwebtext:js \
--grpc-web_out=import_style=typescript,mode=grpcwebtext:ts \
proto/*.proto
.PHONY: tools
go install github.com/vektra/mockery/v2@latest
.PHONY: mocks
mocks:
rm -rf mocks/*
mockery --with-expecter --all
.PHONY: run
run: ## Run infra-sdk grpc server
go run main.go
# Build the docker image
.PHONY: docker-build
docker-build: test
docker build . -t ${IMG}
# Push the docker image
.PHONY: docker-push
docker-push:
docker push ${IMG}
.PHONY: build
build: ## Build awi-infra-guard grpc server
CGO_ENABLED=0 GOOS=${OS} GOARCH=${ARCH} go build -ldflags="-w -s" -o bin/${BIN_NAME}