forked from BuoyantIO/emojivoto
-
Notifications
You must be signed in to change notification settings - Fork 48
/
common.mk
37 lines (25 loc) · 950 Bytes
/
common.mk
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
export IMAGE_TAG := v11.6
.PHONY: package protoc test
target_dir := target
clean:
rm -rf gen
rm -rf $(target_dir)
mkdir -p $(target_dir)
mkdir -p gen
protoc:
protoc -I .. ../proto/*.proto --go_out=paths=source_relative:./gen --go-grpc_out=paths=source_relative:./gen
package: protoc compile build-container
package-ui: build-container-ui
build-container:
docker build .. --platform linux/amd64 -t "datawire/$(svc_name):$(IMAGE_TAG)" --build-arg svc_name=$(svc_name)
build-multi-arch:
docker buildx build .. -t "datawire/$(svc_name):$(IMAGE_TAG)" --build-arg svc_name=$(svc_name) \
-f ../Dockerfile-multi-arch --platform linux/amd64,linux/arm64 --push
build-container-ui:
docker build .. -t "datawire/emojivoto-web-app:$(IMAGE_TAG)" --build-arg svc_name=emojivoto-web-app -f ../Dockerfile-ui
compile:
GOOS=linux GOARCH=amd64 go build -v -o $(target_dir)/$(svc_name) cmd/server.go
test:
go test ./...
run:
go run cmd/server.go