Skip to content

Commit

Permalink
Create cloudbuild.yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
7pandeys authored Dec 10, 2023
1 parent 58a6377 commit 3aea90b
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions cloudbuild.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
substitutions:
_HOST_NAME: europe-west2-docker.pkg.dev
_FOLDER: docker
_TEST: v1
_IMAGE_NAME: vizion

steps:

# Step 1: Scan formatting and lin
- name: 'python:3.10.5'
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 --network=cloudbuild -t ${_HOST_NAME}/${PROJECT_ID}/${_FOLDER}/${_IMAGE_NAME}:${TAG_NAME} .
# docker push ${_HOST_NAME}/${PROJECT_ID}/${_FOLDER}/${_IMAGE_NAME}:${TAG_NAME}
elif [[ "$SHORT_SHA" = ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
docker build --network=cloudbuild -t ${_HOST_NAME}/${PROJECT_ID}/${_FOLDER}/${_IMAGE_NAME}:${SHORT_SHA} .
# docker push ${_HOST_NAME}/${PROJECT_ID}/${_FOLDER}/${_IMAGE_NAME}:${SHORT_SHA}
else
docker build --network=cloudbuild -t ${_HOST_NAME}/${PROJECT_ID}/${_FOLDER}/${_IMAGE_NAME}:${_TEST} .
# docker push ${_HOST_NAME}/${PROJECT_ID}/${_FOLDER}/${_IMAGE_NAME}:${_TEST}
fi
options:
logging: CLOUD_LOGGING_ONLY

0 comments on commit 3aea90b

Please sign in to comment.