Skip to content

Instantly share code, notes, and snippets.

@momota10s
Created April 20, 2021 01:25
Show Gist options
  • Save momota10s/03527cb6c0957f34a86079896ad99537 to your computer and use it in GitHub Desktop.
Save momota10s/03527cb6c0957f34a86079896ad99537 to your computer and use it in GitHub Desktop.
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