Skip to content

Commit fd6dfe1

Browse files
Iman CrooksIman Crooks
Iman Crooks
authored and
Iman Crooks
committed
adding cloudbuild.yml
1 parent 721cdd2 commit fd6dfe1

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

cloudbuild.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
steps:
2+
# Step 1: Install dependencies
3+
- name: 'python'
4+
entrypoint: 'pip'
5+
args: ['install', '-r', 'requirements.txt']
6+
7+
# Step 2: Run tests (optional)
8+
- name: 'python'
9+
entrypoint: 'python'
10+
args: ['-m', 'pytest']
11+
12+
# Step 3: Build Docker image
13+
- name: 'gcr.io/cloud-builders/docker'
14+
args: ['build', '-t', 'gcr.io/$PROJECT_ID/fastapi-app', '.']
15+
16+
# Step 4: Push Docker image to Google Container Registry
17+
- name: 'gcr.io/cloud-builders/docker'
18+
args: ['push', 'gcr.io/$PROJECT_ID/fastapi-app']
19+
20+
# Step 5: Deploy using Terraform (assuming Terraform files are set up)
21+
- name: 'hashicorp/terraform'
22+
args: ['init']
23+
- name: 'hashicorp/terraform'
24+
args: ['apply', '-auto-approve']
25+
26+
images:
27+
- 'gcr.io/$PROJECT_ID/fastapi-app'

0 commit comments

Comments
 (0)