You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
65 lines
1.8 KiB
YAML
65 lines
1.8 KiB
YAML
# Cloud Build Configuration para Artifact Registry + Cloud Run
|
|
# Substitutions: _REGION, _REPO_NAME, _IMAGE_NAME (passados pelo deploy.sh)
|
|
|
|
steps:
|
|
# Step 1: Build Docker image para Artifact Registry
|
|
- name: "gcr.io/cloud-builders/docker"
|
|
args:
|
|
- "build"
|
|
- "-t"
|
|
- "${_REGION}-docker.pkg.dev/$PROJECT_ID/${_REPO_NAME}/${_IMAGE_NAME}:$SHORT_SHA"
|
|
- "-t"
|
|
- "${_REGION}-docker.pkg.dev/$PROJECT_ID/${_REPO_NAME}/${_IMAGE_NAME}:latest"
|
|
- "."
|
|
waitFor: ["-"]
|
|
|
|
# Step 2: Push para Artifact Registry
|
|
- name: "gcr.io/cloud-builders/docker"
|
|
args:
|
|
- "push"
|
|
- "${_REGION}-docker.pkg.dev/$PROJECT_ID/${_REPO_NAME}/${_IMAGE_NAME}:$SHORT_SHA"
|
|
waitFor: ["0"]
|
|
|
|
# Step 3: Deploy para Cloud Run
|
|
- name: "gcr.io/cloud-builders/run"
|
|
args:
|
|
- "deploy"
|
|
- "${_IMAGE_NAME}"
|
|
- "--image=${_REGION}-docker.pkg.dev/$PROJECT_ID/${_REPO_NAME}/${_IMAGE_NAME}:$SHORT_SHA"
|
|
- "--region=${_REGION}"
|
|
- "--platform=managed"
|
|
- "--memory=512Mi"
|
|
- "--cpu=1"
|
|
- "--timeout=3600"
|
|
- "--max-instances=10"
|
|
- "--allow-unauthenticated"
|
|
waitFor: ["1"]
|
|
|
|
# Step 4: Mostrar URL do serviço
|
|
- name: "gcr.io/cloud-builders/run"
|
|
args:
|
|
- "services"
|
|
- "describe"
|
|
- "${_IMAGE_NAME}"
|
|
- "--region=${_REGION}"
|
|
- "--format=value(status.url)"
|
|
waitFor: ["2"]
|
|
|
|
# Configuração de imagens para armazenar no Artifact Registry
|
|
images:
|
|
- "${_REGION}-docker.pkg.dev/$PROJECT_ID/${_REPO_NAME}/${_IMAGE_NAME}:$SHORT_SHA"
|
|
- "${_REGION}-docker.pkg.dev/$PROJECT_ID/${_REPO_NAME}/${_IMAGE_NAME}:latest"
|
|
|
|
# Configurações de build
|
|
options:
|
|
machineType: "N1_HIGHCPU_8"
|
|
logging: CLOUD_LOGGING_ONLY
|
|
|
|
timeout: "1800s"
|
|
|
|
# Substitutions padrão (podem ser sobrescritos pelo deploy.sh)
|
|
substitutions:
|
|
_REGION: "us-central1"
|
|
_REPO_NAME: "orquestrador"
|
|
_IMAGE_NAME: "orquestrador"
|