-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcloudbuild.yaml
46 lines (41 loc) · 1.33 KB
/
cloudbuild.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
substitutions:
_HOST_NAME: europe-west2-docker.pkg.dev
_FOLDER: docker
_IMAGE_NAME: vizion
_TEST: Axfbc
steps:
# Step 1: Scan formatting and linting, pytest
- name: 'python:3.10.13-slim'
entrypoint: 'bash'
args:
- '-c'
- |
source ./run-ci.sh
# # Step 2: Build and push the Docker image
- name: 'gcr.io/cloud-builders/docker'
entrypoint: 'bash'
args:
- '-c'
- |
if [[ "$TAG_NAME" = ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
docker build -t ${_HOST_NAME}/${PROJECT_ID}/${_FOLDER}/${_IMAGE_NAME}:${TAG_NAME} .
# docker push ${_HOST_NAME}/${PROJECT_ID}/${_FOLDER}/${_IMAGE_NAME}:${TAG_NAME}
else
docker build -t ${_HOST_NAME}/${PROJECT_ID}/${_FOLDER}/${_IMAGE_NAME}:${_TEST} .
docker push ${_HOST_NAME}/${PROJECT_ID}/${_FOLDER}/${_IMAGE_NAME}:${_TEST}
fi
# Step 3: Deploy the Docker image to Cloud Run
- name: 'gcr.io/cloud-builders/gcloud'
entrypoint: 'bash'
args:
- '-c'
- |
# if [[ "$TAG_NAME" = ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
gcloud run deploy vizion \
--image=${_HOST_NAME}/${PROJECT_ID}/${_FOLDER}/${_IMAGE_NAME}:${_TEST} \
--platform=managed \
--region=${LOCATION} \
--allow-unauthenticated
# fi
options:
logging: CLOUD_LOGGING_ONLY