Skip to content

Instantly share code, notes, and snippets.

@NewscatcherAPI
Created September 28, 2021 13:22
Show Gist options
  • Save NewscatcherAPI/a8447554c087c645f8112074a6592aec to your computer and use it in GitHub Desktop.
Save NewscatcherAPI/a8447554c087c645f8112074a6592aec to your computer and use it in GitHub Desktop.
Google Kubernetes Engine as an alternative to Cloud Run
steps:
# Build the container image
- name: 'gcr.io/cloud-builders/docker'
args: ['build', '-t', 'gcr.io/$PROJECT_ID/${_SERVICE_NAME}:${_VERSION}', '-f', './${_DIRECTORY_PROJECT}/Dockerfile', '.', '--build-arg', 'directory=${_DIRECTORY_PROJECT}','--build-arg', 'number_workers=${_NB_WORKERS}']
# Push the container image to Container Registry
- name: 'gcr.io/cloud-builders/docker'
args: ['push', 'gcr.io/$PROJECT_ID/${_SERVICE_NAME}:${_VERSION}']
# Deploy container image to Cloud Run
- name: 'gcr.io/google.com/cloudsdktool/cloud-sdk'
entrypoint: gcloud
args:
- 'run'
- 'deploy'
- '${_SERVICE_NAME}'
- '--image'
- 'gcr.io/$PROJECT_ID/${_SERVICE_NAME}:${_VERSION}'
- '--platform'
- 'managed'
- '--concurrency'
- '${_NB_WORKERS}'
- '--max-instances'
- '50'
- '--port'
- '5000'
- '--memory'
- '512Mi'
- '--cpu'
- '1'
- '--timeout'
- '120'
- "--set-env-vars"
- "VARIABLE_1=${_VARIABLE_1},VARIABLE_2=${_VARIABLE_2},PROJECT_ID=${_PROJECT_ID},TOPIC_ID=${_TOPIC_ID}"
images:
- 'gcr.io/$PROJECT_ID/${_SERVICE_NAME}:${_VERSION}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment