-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
42 lines (34 loc) · 1.09 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
VERSION ?= latest
REPO ?= us-docker.pkg.dev/castai-hub/library/cloud-proxy
build:
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags "-s -w" -o bin/castai-cloud-proxy-amd64 ./cmd/proxy
#docker build -t us-docker.pkg.dev/castai-hub/library/svc:$(VERSION) .
docker build -t $(REPO):$(VERSION) --platform linux/amd64 .
.PHONY: build
push:
docker push $(REPO):$(VERSION)
.PHONY: push
release: build push
.PHONY: release
deploy: build push
# Get the latest digest because it doesn't work for some f. reason and put it in the yaml
@DIGEST=$$(docker inspect --format='{{index .RepoDigests 0}}' $(REPO):$(VERSION) | awk -F@ '{print $$2}'); \
sed "s/{{IMAGE_DIGEST}}/$${DIGEST}/g" dummy_deploy.yaml > tmp.yaml
kubectl apply -f tmp.yaml
rm tmp.yaml
.PHONY: deploy
generate-grpc:
mkdir -p proto/gen
protoc proto/v1alpha/proxy.proto \
--go_out=proto/gen --go_opt paths=source_relative \
--go-grpc_out=proto/gen --go-grpc_opt paths=source_relative
.PHONY: generate-grpc
lint:
golangci-lint run ./...
.PHONY: lint
fix:
golangci-lint run --fix ./...
.PHONY: fix
test:
go test ./... -race
.PHONY: test