-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathMakefile
69 lines (53 loc) · 1.71 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
56
57
58
59
60
61
62
63
64
65
66
67
68
GOOS ?= $(shell go env GOOS)
GOARCH ?= $(shell go env GOARCH)
RELEASE_TAG ?= $(shell git describe)
RELEASE_OSES ?= linux
RELEASE_ARCHES ?= amd64 arm64
DOCKER ?= docker
SHELL = /bin/bash
.PHONY: build
build: build-frontend-app
mkdir -p dist/$(GOOS)/$(GOARCH)/bin
CGO_ENABLED=0 GOOS=$(GOOS) GOARCH=$(GOARCH) go build -o dist/$(GOOS)/$(GOARCH)/bin/hotrod ./cmd/hotrod
build-frontend-app:
cd services/frontend/react_app && ./scripts/build.sh
dev-build-docker: build
$(DOCKER) build -t signadot/hotrod:latest \
--platform $(GOOS)/$(GOARCH) \
.
build-docker: build
$(DOCKER) build -t signadot/hotrod:$(RELEASE_TAG)-$(GOOS)-$(GOARCH) \
--platform $(GOOS)/$(GOARCH) \
--provenance false \
.
push-docker: build-docker
$(DOCKER) push signadot/hotrod:$(RELEASE_TAG)-$(GOOS)-$(GOARCH)
build-release:
for os in $(RELEASE_OSES); do \
for arch in $(RELEASE_ARCHES); do \
GOOS=$$os GOARCH=$$arch $(MAKE) build-docker; \
done; \
done;
release-images.txt:
mkdir -p dist
rm -f dist/release-images.txt
for os in $(RELEASE_OSES); do \
for arch in $(RELEASE_ARCHES); do \
echo signadot/hotrod:${RELEASE_TAG}-$$os-$$arch >> dist/release-images.txt; \
done; \
done;
tag-release:
./tag-release.sh $(RELEASE_TAG)
release: build-release release-images.txt tag-release
for os in $(RELEASE_OSES); do \
for arch in $(RELEASE_ARCHES); do \
GOOS=$$os GOARCH=$$arch $(MAKE) push-docker; \
done; \
done;
$(DOCKER) manifest create --amend signadot/hotrod:$(RELEASE_TAG) \
$(shell cat dist/release-images.txt)
$(DOCKER) manifest push signadot/hotrod:$(RELEASE_TAG)
generate-proto:
protoc --go_out=. --go_opt=paths=source_relative \
--go-grpc_out=. --go-grpc_opt=paths=source_relative \
services/route/route.proto