|
| 1 | +steps: |
| 2 | + # Step 1: build and push all images to Artifact Registry |
| 3 | + |
| 4 | + # Build and push peerprep-fe |
| 5 | + - name: "gcr.io/cloud-builders/docker" |
| 6 | + args: |
| 7 | + [ |
| 8 | + "build", |
| 9 | + "-t", |
| 10 | + "asia-southeast1-docker.pkg.dev/cs3219-g11-peerprep/cs3219-g11-repo/peerprep-fe:latest", |
| 11 | + "--build-arg", |
| 12 | + "NEXT_PUBLIC_API_GATEWAY_URL=${_NEXT_PUBLIC_API_GATEWAY_URL}", |
| 13 | + "--build-arg", |
| 14 | + "NEXT_PUBLIC_GITHUB_CLIENT_ID=${_NEXT_PUBLIC_GITHUB_CLIENT_ID}", |
| 15 | + "-f", |
| 16 | + "peerprep-fe/Dockerfile", |
| 17 | + "peerprep-fe", |
| 18 | + ] |
| 19 | + |
| 20 | + # Push the peerprep-fe image to Artifact Registry |
| 21 | + - name: "gcr.io/cloud-builders/docker" |
| 22 | + args: |
| 23 | + [ |
| 24 | + "push", |
| 25 | + "asia-southeast1-docker.pkg.dev/cs3219-g11-peerprep/cs3219-g11-repo/peerprep-fe:latest", |
| 26 | + ] |
| 27 | + |
| 28 | + # Build and push question-service |
| 29 | + - name: "gcr.io/cloud-builders/docker" |
| 30 | + args: |
| 31 | + [ |
| 32 | + "build", |
| 33 | + "-t", |
| 34 | + "asia-southeast1-docker.pkg.dev/cs3219-g11-peerprep/cs3219-g11-repo/question-svc:latest", |
| 35 | + "-f", |
| 36 | + "question-service/Dockerfile", |
| 37 | + "question-service", |
| 38 | + ] |
| 39 | + |
| 40 | + # Push the question-service image to Artifact Registry |
| 41 | + - name: "gcr.io/cloud-builders/docker" |
| 42 | + args: |
| 43 | + [ |
| 44 | + "push", |
| 45 | + "asia-southeast1-docker.pkg.dev/cs3219-g11-peerprep/cs3219-g11-repo/question-svc:latest", |
| 46 | + ] |
| 47 | + |
| 48 | + # Build and push user-service |
| 49 | + - name: "gcr.io/cloud-builders/docker" |
| 50 | + args: |
| 51 | + [ |
| 52 | + "build", |
| 53 | + "-t", |
| 54 | + "asia-southeast1-docker.pkg.dev/cs3219-g11-peerprep/cs3219-g11-repo/user-svc:latest", |
| 55 | + "-f", |
| 56 | + "user-service/Dockerfile", |
| 57 | + "user-service", |
| 58 | + ] |
| 59 | + |
| 60 | + # Push the user-service image to Artifact Registry |
| 61 | + - name: "gcr.io/cloud-builders/docker" |
| 62 | + args: |
| 63 | + [ |
| 64 | + "push", |
| 65 | + "asia-southeast1-docker.pkg.dev/cs3219-g11-peerprep/cs3219-g11-repo/user-svc:latest", |
| 66 | + ] |
| 67 | + |
| 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 | + |
| 88 | + # Step 2: Clean up and deploy to GKE |
| 89 | + |
| 90 | + # Clean up before deploying peerprep-fe |
| 91 | + - name: "ubuntu" |
| 92 | + args: ["rm", "-rf", "output"] |
| 93 | + |
| 94 | + # Deploy peerprep-fe to Google Kubernetes Engine (GKE) |
| 95 | + - name: "gcr.io/cloud-builders/gke-deploy" |
| 96 | + args: |
| 97 | + - run |
| 98 | + - --filename=k8s/peerprep-fe.yml |
| 99 | + - --image=asia-southeast1-docker.pkg.dev/cs3219-g11-peerprep/cs3219-g11-repo/peerprep-fe:latest |
| 100 | + - --location=asia-southeast1 |
| 101 | + - --cluster=cs3219-g11-peerprep-kubes |
| 102 | + |
| 103 | + # Clean up before deploying question-service |
| 104 | + - name: "ubuntu" |
| 105 | + args: ["rm", "-rf", "output"] |
| 106 | + |
| 107 | + # Deploy question-service to Google Kubernetes Engine (GKE) |
| 108 | + - name: "gcr.io/cloud-builders/gke-deploy" |
| 109 | + args: |
| 110 | + - run |
| 111 | + - --filename=k8s/question-service.yml |
| 112 | + - --image=asia-southeast1-docker.pkg.dev/cs3219-g11-peerprep/cs3219-g11-repo/question-svc:latest |
| 113 | + - --location=asia-southeast1 |
| 114 | + - --cluster=cs3219-g11-peerprep-kubes |
| 115 | + |
| 116 | + # Clean up before deploying user-service |
| 117 | + - name: "ubuntu" |
| 118 | + args: ["rm", "-rf", "output"] |
| 119 | + |
| 120 | + # Deploy user-service to Google Kubernetes Engine (GKE) |
| 121 | + - name: "gcr.io/cloud-builders/gke-deploy" |
| 122 | + args: |
| 123 | + - run |
| 124 | + - --filename=k8s/user-service.yml |
| 125 | + - --image=asia-southeast1-docker.pkg.dev/cs3219-g11-peerprep/cs3219-g11-repo/user-svc:latest |
| 126 | + - --location=asia-southeast1 |
| 127 | + - --cluster=cs3219-g11-peerprep-kubes |
| 128 | + |
| 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 | + |
| 142 | + # Step 3: update the deployments with the new images |
| 143 | + |
| 144 | + # Update the peerprep-fe deployment |
| 145 | + - name: "gcr.io/cloud-builders/kubectl" |
| 146 | + args: |
| 147 | + - "set" |
| 148 | + - "image" |
| 149 | + - "deployment/peerprep-fe" |
| 150 | + - "peerprep-fe=asia-southeast1-docker.pkg.dev/cs3219-g11-peerprep/cs3219-g11-repo/peerprep-fe:latest" |
| 151 | + env: |
| 152 | + - "CLOUDSDK_COMPUTE_ZONE=asia-southeast1" |
| 153 | + - "CLOUDSDK_CONTAINER_CLUSTER=cs3219-g11-peerprep-kubes" |
| 154 | + |
| 155 | + # Update the question-service deployment |
| 156 | + - name: "gcr.io/cloud-builders/kubectl" |
| 157 | + args: |
| 158 | + - "set" |
| 159 | + - "image" |
| 160 | + - "deployment/question-svc" |
| 161 | + - "question-svc=asia-southeast1-docker.pkg.dev/cs3219-g11-peerprep/cs3219-g11-repo/question-svc:latest" |
| 162 | + env: |
| 163 | + - "CLOUDSDK_COMPUTE_ZONE=asia-southeast1" |
| 164 | + - "CLOUDSDK_CONTAINER_CLUSTER=cs3219-g11-peerprep-kubes" |
| 165 | + |
| 166 | + # Update the user-service deployment hi |
| 167 | + - name: "gcr.io/cloud-builders/kubectl" |
| 168 | + args: |
| 169 | + - "set" |
| 170 | + - "image" |
| 171 | + - "deployment/user-svc" |
| 172 | + - "user-svc=asia-southeast1-docker.pkg.dev/cs3219-g11-peerprep/cs3219-g11-repo/user-svc:latest" |
| 173 | + env: |
| 174 | + - "CLOUDSDK_COMPUTE_ZONE=asia-southeast1" |
| 175 | + - "CLOUDSDK_CONTAINER_CLUSTER=cs3219-g11-peerprep-kubes" |
| 176 | + |
| 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 | + |
| 188 | +substitutions: |
| 189 | + _NEXT_PUBLIC_API_GATEWAY_URL: "" |
| 190 | + _NEXT_PUBLIC_GITHUB_CLIENT_ID: "" |
| 191 | + |
| 192 | +options: |
| 193 | + dynamic_substitutions: true |
| 194 | + |
| 195 | +images: |
| 196 | + - "asia-southeast1-docker.pkg.dev/cs3219-g11-peerprep/cs3219-g11-repo/peerprep-fe:latest" |
| 197 | + - "asia-southeast1-docker.pkg.dev/cs3219-g11-peerprep/cs3219-g11-repo/question-svc:latest" |
| 198 | + - "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