-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
40 lines (31 loc) · 1.42 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
include .env
LOCAL_BIN:=$(CURDIR)/bin
install-deps:
GOBIN=$(LOCAL_BIN) go install google.golang.org/protobuf/cmd/[email protected]
GOBIN=$(LOCAL_BIN) go install -mod=mod google.golang.org/grpc/cmd/[email protected]
GOBIN=$(LOCAL_BIN) go install github.com/pressly/goose/v3/cmd/[email protected]
get-deps:
go get -u google.golang.org/protobuf/cmd/protoc-gen-go
go get -u google.golang.org/grpc/cmd/protoc-gen-go-grpc
local-migration-status:
${LOCAL_BIN}/goose -dir ${LOCAL_MIGRATION_DIR} postgres ${LOCAL_MIGRATION_DSN} status -v
local-migration-up:
${LOCAL_BIN}/goose -dir ${LOCAL_MIGRATION_DIR} postgres ${LOCAL_MIGRATION_DSN} up -v
local-migration-down:
${LOCAL_BIN}/goose -dir ${LOCAL_MIGRATION_DIR} postgres ${LOCAL_MIGRATION_DSN} down -v
generate:
make generate-chat-api
generate-chat-api:
mkdir -p pkg/chat_api
protoc --proto_path api/chat_api \
--go_out=pkg/chat_api --go_opt=paths=source_relative \
--plugin=protoc-gen-go=bin/protoc-gen-go \
--go-grpc_out=pkg/chat_api --go-grpc_opt=paths=source_relative \
--plugin=protoc-gen-go-grpc=bin/protoc-gen-go-grpc \
api/chat_api/chat_api.proto
build:
GOOS=linux GOARCH=amd64 go build -o chat-server cmd/grpc_server/main.go
docker-build-and-push:
docker buildx build --no-cache --platform linux/amd64 -t ${REGISTRY}/chat-server:v0.0.1 .
aws ecr get-login-password --region eu-north-1 | docker login --username AWS --password-stdin ${REGISTRY}
docker push ${REGISTRY}