GCP

[GCP] 컨테이너 이미지 빌드 및 연속 배포

IntegerString 2022. 6. 2. 22:02

빌드 구성 파일 생성 (빌드를 하려고 하는 디렉토리 안에 생성)

steps:
- name: 'gcr.io/cloud-builders/docker'
  args: ['build', '-t', 'gcr.io/$PROJECT_ID/streamlit:$COMMIT_SHA', '.']
- name: 'gcr.io/cloud-builders/docker'
  args: ['push', 'gcr.io/$PROJECT_ID/streamlit:$COMMIT_SHA']
- name: 'gcr.io/google.com/cloudsdktool/cloud-sdk'
  entrypoint: gcloud
  args: 
  - 'run'
  - 'deploy'
  - 'gcp-exam-dumps'
  - '--image'
  - 'gcr.io/$PROJECT_ID/streamlit:$COMMIT_SHA'
  - '--region'
  - 'asia-northeast3'
  - '--command'
  - 'streamlit'
  - '--args'
  - 'run'
  - '--args'
  - 'app.py'
  - '--port'
  - '8501'
  - '--min-instances'
  - '1'
  - '--max-instances'
  - '10'
  - '--allow-unauthenticated'
images:
- 'gcr.io/$PROJECT_ID/streamlit:$COMMIT_SHA'
options:
  logging: CLOUD_LOGGING_ONLY

저장소 연결 클릭
소스 선택
GOOGLE CLOUD BUILD 설치
GOOGLE CLOUD BUILD 설치
저장소 선택
저장소 연결 완료 및 트리거 만들기 클릭
트리거 생성
깃에 푸시 후 승인 대기 중인 트리거 확인

배포 URL: https://gcp-exam-dumps-n6my7u6wuq-du.a.run.app