|
5 | 5 | ## ============================================================ |
6 | 6 |
|
7 | 7 | .PHONY: dev dev-api dev-web test test-api lint build-api build-web \ |
| 8 | + push-api push-web deploy-api deploy-web deploy \ |
8 | 9 | infra-plan infra-apply ingest ingest-batch ingest-batch-skip \ |
9 | 10 | ingest-dry-run spec help |
10 | 11 |
|
@@ -38,6 +39,45 @@ build-api: ## Build the backend Docker image |
38 | 39 | build-web: ## Build the frontend Docker image |
39 | 40 | docker build -f docker/Dockerfile.frontend -t gitunderstand-web . |
40 | 41 |
|
| 42 | +## ------ Docker Push (to Artifact Registry) --------------------- |
| 43 | + |
| 44 | +push-api: build-api ## Build & push API image to GAR |
| 45 | + docker tag gitunderstand-api us-central1-docker.pkg.dev/gitunderstand/bettercodewiki/api:latest |
| 46 | + docker push us-central1-docker.pkg.dev/gitunderstand/bettercodewiki/api:latest |
| 47 | + |
| 48 | +push-web: build-web ## Build & push Web image to GAR |
| 49 | + docker tag gitunderstand-web us-central1-docker.pkg.dev/gitunderstand/bettercodewiki/web:latest |
| 50 | + docker push us-central1-docker.pkg.dev/gitunderstand/bettercodewiki/web:latest |
| 51 | + |
| 52 | +## ------ Deploy (manual gcloud) --------------------------------- |
| 53 | + |
| 54 | +deploy-api: ## Deploy API to Cloud Run (uses latest GAR image) |
| 55 | + gcloud run deploy gitunderstand-api \ |
| 56 | + --image us-central1-docker.pkg.dev/gitunderstand/bettercodewiki/api:latest \ |
| 57 | + --region us-central1 \ |
| 58 | + --platform managed \ |
| 59 | + --allow-unauthenticated \ |
| 60 | + --service-account runtime-sa@gitunderstand.iam.gserviceaccount.com \ |
| 61 | + --port 8001 \ |
| 62 | + --cpu 1 --memory 2Gi \ |
| 63 | + --min-instances 0 --max-instances 3 \ |
| 64 | + --set-env-vars "ENVIRONMENT=production,WIKI_STORAGE_BACKEND=gcs,GCS_BUCKET_NAME=gitunderstand-wikicache" \ |
| 65 | + --set-secrets "GOOGLE_API_KEY=google-api-key:latest,OPENAI_API_KEY=openai-api-key:latest,CLERK_SECRET_KEY=clerk-secret-key:latest,SUPABASE_URL=supabase-url:latest,SUPABASE_SERVICE_ROLE_KEY=supabase-service-role-key:latest" |
| 66 | + |
| 67 | +deploy-web: ## Deploy Web to Cloud Run (uses latest GAR image) |
| 68 | + gcloud run deploy gitunderstand-web \ |
| 69 | + --image us-central1-docker.pkg.dev/gitunderstand/bettercodewiki/web:latest \ |
| 70 | + --region us-central1 \ |
| 71 | + --platform managed \ |
| 72 | + --allow-unauthenticated \ |
| 73 | + --service-account runtime-sa@gitunderstand.iam.gserviceaccount.com \ |
| 74 | + --port 3000 \ |
| 75 | + --cpu 1 --memory 512Mi \ |
| 76 | + --min-instances 0 --max-instances 5 \ |
| 77 | + --set-env-vars "ENVIRONMENT=production,NODE_ENV=production" |
| 78 | + |
| 79 | +deploy: deploy-api deploy-web ## Deploy both services to Cloud Run |
| 80 | + |
41 | 81 | ## ------ Infrastructure (Terraform) --------------------------- |
42 | 82 |
|
43 | 83 | infra-plan: ## Preview Terraform changes for production |
|
0 commit comments