-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
47 lines (40 loc) · 1.87 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
.PHONY: check-deps buf-gen gen-api-client generate build deploy
check-deps:
@echo "Checking dependencies..."
@which buf > /dev/null || (echo "\nError: 'buf' is not installed.\nPlease install 'buf' on macOS with:\n brew install bufbuild/buf/buf\n" && exit 1)
@which openapi-generator-cli > /dev/null || (echo "\nError: 'openapi-generator-cli' is not installed.\nPlease install it on macOS with:\n brew install openapi-generator\n" && exit 1)
@echo "All dependencies are installed."
buf-gen: check-deps
@echo "Running buf generate..."
buf generate --path proto/
gen-api-client: check-deps
@echo "Generating TypeScript API client..."
openapi-generator-cli generate \
-i gen/openapiv2/proto/server.swagger.json \
-g typescript-fetch \
-o ./web/src/apiClient
generate: buf-gen gen-api-client
@echo "Code generation completed successfully."
build:
@echo "Building server Docker images..."
docker build -f arena.Dockerfile --platform linux/amd64 -t gcr.io/humor-arena/server:latest --target app .
docker build -f leaderboard.Dockerfile --platform linux/amd64 -t gcr.io/humor-arena/leaderboard:latest --target app .
push:
@echo "Pushing Docker images to Google Container Registry..."
docker push gcr.io/humor-arena/server:latest
docker push gcr.io/humor-arena/leaderboard:latest
deploy: build push
@echo "Deploying to Google Cloud Run..."
gcloud run deploy humor-arena \
--image gcr.io/humor-arena/server:latest \
--platform managed \
--region us-central1 \
--allow-unauthenticated \
--service-account [email protected]
gcloud run jobs update leaderboard \
--image gcr.io/humor-arena/leaderboard:latest \
--task-timeout 10m \
--region us-central1 \
--service-account [email protected]
gcloud run jobs execute leaderboard --region us-central1
@echo "Deployment completed successfully."