From 951bc2b40ab8e54d2b87442e1d313bb884b96104 Mon Sep 17 00:00:00 2001 From: Stanley Cheung Date: Fri, 20 Feb 2026 21:02:47 +0800 Subject: [PATCH] fix: cloudbuild yaml --- apps/web/Dockerfile | 2 ++ apps/web/cloudbuild.yaml | 48 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+) create mode 100644 apps/web/cloudbuild.yaml diff --git a/apps/web/Dockerfile b/apps/web/Dockerfile index c936badc..d711ba26 100644 --- a/apps/web/Dockerfile +++ b/apps/web/Dockerfile @@ -12,6 +12,8 @@ WORKDIR /app COPY --from=deps /app/node_modules ./node_modules COPY . . +ARG NEXT_PUBLIC_API_URL +ENV NEXT_PUBLIC_API_URL=$NEXT_PUBLIC_API_URL ENV NODE_ENV=production RUN npm run build diff --git a/apps/web/cloudbuild.yaml b/apps/web/cloudbuild.yaml new file mode 100644 index 00000000..9820444e --- /dev/null +++ b/apps/web/cloudbuild.yaml @@ -0,0 +1,48 @@ +steps: + - name: gcr.io/cloud-builders/docker + id: Build image + args: + - build + - -f + - Dockerfile + - --build-arg + - NEXT_PUBLIC_API_URL=${_NEXT_PUBLIC_API_URL} + - -t + - ${_AR_HOSTNAME}/${_AR_PROJECT_ID}/${_AR_REPOSITORY}/${_SERVICE_NAME}:latest + - -t + - ${_AR_HOSTNAME}/${_AR_PROJECT_ID}/${_AR_REPOSITORY}/${_SERVICE_NAME}:${SHORT_SHA} + - . + + - name: gcr.io/cloud-builders/docker + id: Push latest + args: + - push + - ${_AR_HOSTNAME}/${_AR_PROJECT_ID}/${_AR_REPOSITORY}/${_SERVICE_NAME}:latest + + - name: gcr.io/cloud-builders/docker + id: Push commit tag + args: + - push + - ${_AR_HOSTNAME}/${_AR_PROJECT_ID}/${_AR_REPOSITORY}/${_SERVICE_NAME}:${SHORT_SHA} + + - name: gcr.io/google.com/cloudsdktool/cloud-sdk:slim + id: Deploy to Cloud Run + entrypoint: gcloud + args: + - run + - deploy + - ${_SERVICE_NAME} + - --image + - ${_AR_HOSTNAME}/${_AR_PROJECT_ID}/${_AR_REPOSITORY}/${_SERVICE_NAME}:${SHORT_SHA} + - --region + - ${_DEPLOY_REGION} + - --platform + - ${_PLATFORM} + - --quiet + +images: + - ${_AR_HOSTNAME}/${_AR_PROJECT_ID}/${_AR_REPOSITORY}/${_SERVICE_NAME}:latest + - ${_AR_HOSTNAME}/${_AR_PROJECT_ID}/${_AR_REPOSITORY}/${_SERVICE_NAME}:${SHORT_SHA} + +options: + logging: CLOUD_LOGGING_ONLY