generated from VLADIMIR/template
35 lines
1.2 KiB
Makefile
35 lines
1.2 KiB
Makefile
# Protobuf generation (tool versions are documented in README.md).
|
|
# Install the pinned plugins before running: make install-generate-tools.
|
|
generate:
|
|
rm -rf proto
|
|
mkdir -p proto
|
|
|
|
protoc -I ./api \
|
|
--go_out ./proto --go_opt paths=source_relative \
|
|
--go-grpc_out ./proto --go-grpc_opt paths=source_relative \
|
|
--grpc-gateway_out ./proto --grpc-gateway_opt paths=source_relative,generate_unbound_methods=true \
|
|
--openapiv2_out=./cmd/evening_detective_server --openapiv2_opt allow_merge=true,merge_file_name=main \
|
|
./api/main.proto
|
|
|
|
install-generate-tools:
|
|
go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.36.11
|
|
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.6.2
|
|
go install github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway@v2.30.0
|
|
go install github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2@v2.30.0
|
|
|
|
run:
|
|
go run ./cmd/evening_detective_server
|
|
|
|
build-builder:
|
|
docker build -f Dockerfile.builder -t my-go-builder .
|
|
|
|
build-linux:
|
|
docker run --rm \
|
|
-v "$$PWD":/app \
|
|
-w /app \
|
|
my-go-builder sh -c \
|
|
"CGO_ENABLED=0 GOOS=linux GOARCH=$(GOARCH) go build -o bin/evening_detective_server ./cmd/evening_detective_server"
|
|
|
|
test:
|
|
go test -count=1 ./...
|