fix: cloudbuild yaml

This commit is contained in:
Stanley Cheung 2026-02-20 21:02:47 +08:00
parent dea382a8c9
commit 951bc2b40a
2 changed files with 50 additions and 0 deletions

View File

@ -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

48
apps/web/cloudbuild.yaml Normal file
View File

@ -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