Created
April 20, 2021 01:25
-
-
Save momota10s/03527cb6c0957f34a86079896ad99537 to your computer and use it in GitHub Desktop.
This file contains 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
steps: | |
# Access the id_github file from Secret Manager | |
- name: gcr.io/cloud-builders/gcloud | |
entrypoint: 'bash' | |
args: [ '-c', 'gcloud secrets versions access latest --secret=github-access-token > /root/github-access-token' ] | |
volumes: | |
- name: 'vol' | |
path: /root/ | |
# Build the container image | |
- name: 'docker' | |
entrypoint: 'sh' | |
args: [ | |
'-c', | |
'docker build --build-arg CREDENTIALS="$(cat /root/github-access-token)" | |
-f Dockerfile | |
-t us.gcr.io/$PROJECT_ID/${_IMAGE_NAME}:$COMMIT_SHA | |
-t us.gcr.io/$PROJECT_ID/${_IMAGE_NAME}:latest | |
.' | |
] | |
volumes: | |
- name: 'vol' | |
path: /root/ | |
# Push the container image | |
- name: gcr.io/cloud-builders/docker | |
args: | |
- push | |
- us.gcr.io/$PROJECT_ID/${_IMAGE_NAME} | |
timeout: 1200s |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment