How can I specify a region for the Cloud Storage buckets used by Cloud Build for a Cloud Run deployment?

前端 未结 2 416
忘掉有多难
忘掉有多难 2021-01-12 03:16

When deploying a docker container image to Cloud Run, I can choose a region, which is fine. Cloud Run delegates the build to Cloud Build, which apparently creates two bucke

2条回答
  •  时光说笑
    2021-01-12 03:41

    Looks like this is only possible by doing what you're mentioning in the comments:

    1. Create a storage bucket in us-east1 as the source bucket ($SOURCE_BUCKET);
    2. Create a Artifact Registry repo in us-east1;
    3. Create the following cloudbuild.yaml:
      steps:
      - name: 'gcr.io/cloud-builders/docker'
        args: ['build', '-t', 'us-east1-docker.pkg.dev/$PROJECT_ID/my-repo/my-image', '.']
      images:
      - 'us-east1-docker.pkg.dev/$PROJECT_ID/my-repo/my-image'
      
    4. Deploy with:
      $ gcloud builds submit --config cloudbuild.yaml --gcs-source-staging-dir=gs://$SOURCE_BUCKET/source
      

    More details here: https://cloud.google.com/artifact-registry/docs/configure-cloud-build

    I think it should at least be possible to specify the Artifact Registry repo with the --tag option and have it be automatically created, but it currently rejects any domain that isn't gcr.io outright.

提交回复
热议问题