1010 " asia-southeast1-docker.pkg.dev/cs3219-g11-peerprep/cs3219-g11-repo/peerprep-fe:latest" ,
1111 " --build-arg" ,
1212 " NEXT_PUBLIC_API_GATEWAY_URL=${_NEXT_PUBLIC_API_GATEWAY_URL}" ,
13+ " --build-arg" ,
14+ " NEXT_PUBLIC_GITHUB_CLIENT_ID=${_NEXT_PUBLIC_GITHUB_CLIENT_ID}" ,
1315 " -f" ,
1416 " peerprep-fe/Dockerfile" ,
1517 " peerprep-fe" ,
@@ -63,6 +65,26 @@ steps:
6365 " asia-southeast1-docker.pkg.dev/cs3219-g11-peerprep/cs3219-g11-repo/user-svc:latest" ,
6466 ]
6567
68+ # Build and push api-gateway
69+ - name : " gcr.io/cloud-builders/docker"
70+ args :
71+ [
72+ " build" ,
73+ " -t" ,
74+ " asia-southeast1-docker.pkg.dev/cs3219-g11-peerprep/cs3219-g11-repo/api-gateway:latest" ,
75+ " -f" ,
76+ " api-gateway/Dockerfile" ,
77+ " api-gateway" ,
78+ ]
79+
80+ # Push the api-gateway image to Artifact Registry
81+ - name : " gcr.io/cloud-builders/docker"
82+ args :
83+ [
84+ " push" ,
85+ " asia-southeast1-docker.pkg.dev/cs3219-g11-peerprep/cs3219-g11-repo/api-gateway:latest" ,
86+ ]
87+
6688 # Step 2: Clean up and deploy to GKE
6789
6890 # Clean up before deploying peerprep-fe
@@ -104,6 +126,19 @@ steps:
104126 - --location=asia-southeast1
105127 - --cluster=cs3219-g11-peerprep-kubes
106128
129+ # Clean up before deploying api-gateway
130+ - name : " ubuntu"
131+ args : ["rm", "-rf", "output"]
132+
133+ # Deploy api-gateway to Google Kubernetes Engine (GKE)
134+ - name : " gcr.io/cloud-builders/gke-deploy"
135+ args :
136+ - run
137+ - --filename=k8s/api-gateway.yml
138+ - --image=asia-southeast1-docker.pkg.dev/cs3219-g11-peerprep/cs3219-g11-repo/api-gateway:latest
139+ - --location=asia-southeast1
140+ - --cluster=cs3219-g11-peerprep-kubes
141+
107142 # Step 3: update the deployments with the new images
108143
109144 # Update the peerprep-fe deployment
@@ -139,8 +174,20 @@ steps:
139174 - " CLOUDSDK_COMPUTE_ZONE=asia-southeast1"
140175 - " CLOUDSDK_CONTAINER_CLUSTER=cs3219-g11-peerprep-kubes"
141176
177+ # Update the api-gateway deployment
178+ - name : " gcr.io/cloud-builders/kubectl"
179+ args :
180+ - " set"
181+ - " image"
182+ - " deployment/api-gateway"
183+ - " api-gateway=asia-southeast1-docker.pkg.dev/cs3219-g11-peerprep/cs3219-g11-repo/api-gateway:latest"
184+ env :
185+ - " CLOUDSDK_COMPUTE_ZONE=asia-southeast1"
186+ - " CLOUDSDK_CONTAINER_CLUSTER=cs3219-g11-peerprep-kubes"
187+
142188substitutions :
143189 _NEXT_PUBLIC_API_GATEWAY_URL : " "
190+ _NEXT_PUBLIC_GITHUB_CLIENT_ID : " "
144191
145192options :
146193 dynamic_substitutions : true
@@ -149,3 +196,4 @@ images:
149196 - " asia-southeast1-docker.pkg.dev/cs3219-g11-peerprep/cs3219-g11-repo/peerprep-fe:latest"
150197 - " asia-southeast1-docker.pkg.dev/cs3219-g11-peerprep/cs3219-g11-repo/question-svc:latest"
151198 - " asia-southeast1-docker.pkg.dev/cs3219-g11-peerprep/cs3219-g11-repo/user-svc:latest"
199+ - " asia-southeast1-docker.pkg.dev/cs3219-g11-peerprep/cs3219-g11-repo/api-gateway:latest"
0 commit comments