@@ -65,6 +65,26 @@ steps:
6565 " asia-southeast1-docker.pkg.dev/cs3219-g11-peerprep/cs3219-g11-repo/user-svc:latest" ,
6666 ]
6767
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+
6888 # Step 2: Clean up and deploy to GKE
6989
7090 # Clean up before deploying peerprep-fe
@@ -106,6 +126,19 @@ steps:
106126 - --location=asia-southeast1
107127 - --cluster=cs3219-g11-peerprep-kubes
108128
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+
109142 # Step 3: update the deployments with the new images
110143
111144 # Update the peerprep-fe deployment
@@ -141,6 +174,17 @@ steps:
141174 - " CLOUDSDK_COMPUTE_ZONE=asia-southeast1"
142175 - " CLOUDSDK_CONTAINER_CLUSTER=cs3219-g11-peerprep-kubes"
143176
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+
144188substitutions :
145189 _NEXT_PUBLIC_API_GATEWAY_URL : " "
146190 _NEXT_PUBLIC_GITHUB_CLIENT_ID : " "
@@ -152,3 +196,4 @@ images:
152196 - " asia-southeast1-docker.pkg.dev/cs3219-g11-peerprep/cs3219-g11-repo/peerprep-fe:latest"
153197 - " asia-southeast1-docker.pkg.dev/cs3219-g11-peerprep/cs3219-g11-repo/question-svc:latest"
154198 - " 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