-
Notifications
You must be signed in to change notification settings - Fork 88
Expand file tree
/
Copy pathcloudbuild.yaml
More file actions
37 lines (34 loc) · 1021 Bytes
/
Copy pathcloudbuild.yaml
File metadata and controls
37 lines (34 loc) · 1021 Bytes
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
steps:
# Step 1: Install dependencies in a virtual environment
- name: 'python:3.9'
entrypoint: 'sh'
args:
- '-c'
- |
python -m venv venv && \
. venv/bin/activate && \
pip install --upgrade pip && \
pip install -r app/requirements.txt
# Step 2: Run tests in the same environment
- name: 'python:3.9'
entrypoint: 'sh'
args:
- '-c'
- |
. venv/bin/activate && \
python -m unittest discover tests
# Step 3: Build Docker image
- name: 'gcr.io/cloud-builders/docker'
args:
- 'build'
- '-t'
- 'us-central1-docker.pkg.dev/oval-turbine-495504-h2/myimage/myapp:$BUILD_ID'
- '.'
# Step 4: Push Docker image to Artifact Registry
- name: 'gcr.io/cloud-builders/docker'
args:
- 'push'
- 'us-central1-docker.pkg.dev/oval-turbine-495504-h2/myimage/myapp:$BUILD_ID'
images:
- 'us-east1-docker.pkg.dev/openwriteup/cicd/myapp:$BUILD_ID'
logsBucket: "gs://lab9-log-archive-biswa"