Skip to content

Instantly share code, notes, and snippets.

@ntakouris
Created February 13, 2024 12:55
Show Gist options
  • Save ntakouris/a0a9099e72f8c90556b18e248c7fa8b3 to your computer and use it in GitHub Desktop.
Save ntakouris/a0a9099e72f8c90556b18e248c7fa8b3 to your computer and use it in GitHub Desktop.
.devcontainer.json template to forward GCP Credentials into container and provide access token during container building
{
"name": "<your-project>",
"build": {
"dockerfile": "../Dockerfile",
"args":{
"GCLOUD_ACCESS_TOKEN": "$(gcloud auth print-access-token)"
}
},
"mounts": [
"source=${localEnv:HOME}/.config/gcloud,target=/root/.config/gcloud,type=bind"
],
"containerEnv": {
"GOOGLE_APPLICATION_CREDENTIALS": "/root/.config/gcloud/application_default_credentials.json",
"GCLOUD_PROJECT": "<your-project>",
},
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment