Created
February 13, 2024 12:55
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"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