-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
37 lines (29 loc) · 907 Bytes
/
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
.PHONY: proto
IMAGE_NAME="amadeus-go"
NETWORK="amadeus"
PROJECT_ROOT="/go/src/amadeus-go"
PWD=$(shell pwd)
PROTO_FILES=$(shell grep --exclude=*.pb.go -r .proto$ ${PWD}/api/ | cut -d: -f1 | sort | uniq)
PROTO_IMPORT=$(shell dirname ${PWD})
GO_FILES=$(shell find . | grep -v pb.go | grep .go)
proto:
for i in ${PROTO_FILES}; do protoc -I ${PROTO_IMPORT} --go_out=plugins=grpc:${PROTO_IMPORT} $$i; done
build:
docker build -t ${IMAGE_NAME} .
up:
docker network ls | grep ${NETWORK} | [ `wc -l` -ne 1 ] && \
docker network create ${NETWORK} || echo "\`${NETWORK}\` network already exists"
docker run -v ${PWD}:${PROJECT_ROOT}:ro \
--net ${NETWORK} \
--name ${IMAGE_NAME} \
-dp 8000:8000 \
${IMAGE_NAME}
down:
docker container stop ${IMAGE_NAME} | \
xargs docker rm
dev_run:
go run ./cmd/srv/srv.go
dev_cli:
go run ./cmd/cli/cli.go
gofmt:
for i in ${GO_FILES}; do gofmt -w $$i; done