Skip to content

Commit

Permalink
Merge pull request #43 from rchapman83:dev
Browse files Browse the repository at this point in the history
added buildfile and updated components.
  • Loading branch information
rchapman83 authored Dec 10, 2024
2 parents 5cb8f1f + 1f3fb2f commit a1d7b85
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 6 deletions.
7 changes: 4 additions & 3 deletions app.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
runtime: python37
runtime: python
# env: flex
# runtime_config:
# python_version: 3
runtime_config:
operating_system: 'ubuntu22'
runtime_version: '3.12'

env_variables:
# GAE_INSTANCE can also be used as proj name
Expand Down
59 changes: 59 additions & 0 deletions app/cloudbuild.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@

# Build from GCP CloudBuild samples - github.com/GoogleCloudPlatform/cloud-build-samples/tree/main/python-example-flask
# [START cloudbuild_python_yaml]
# [START cloudbuild_python_dependencies_yaml]
steps:
# Install dependencies
- name: python
entrypoint: pip
args: ["install", "-r", "requirements.txt", "--user"]
# [END cloudbuild_python_dependencies_yaml]

# [START cloudbuild_python_tests_yaml]
# Run unit tests
- name: python
entrypoint: python
args: ["-m", "pytest", "--junitxml=${SHORT_SHA}_test_log.xml"]
# [END cloudbuild_python_tests_yaml]

# [START cloudbuild_python_image_yaml]
# Docker Build
- name: 'gcr.io/cloud-builders/docker'
args: ['build', '-t',
# 'us-central1-docker.pkg.dev/${PROJECT_ID}/${_ARTIFACT_REGISTRY_REPO}/myimage:${SHORT_SHA}', '.']
'australia-southeast1-docker.pkg.dev/${PROJECT_ID}/${_ARTIFACT_REGISTRY_REPO}/myimage:${SHORT_SHA}', '.']
# [END cloudbuild_python_image_yaml]

# [START cloudbuild_python_push_yaml]
# Docker push to Google Artifact Registry
- name: 'gcr.io/cloud-builders/docker'
# args: ['push', 'us-central1-docker.pkg.dev/${PROJECT_ID}/${_ARTIFACT_REGISTRY_REPO}/myimage:${SHORT_SHA}']
args: ['push', 'australia-southeast1-docker.pkg.dev/${PROJECT_ID}/${_ARTIFACT_REGISTRY_REPO}/myimage:${SHORT_SHA}']
# [END cloudbuild_python_push_yaml]

# [START cloudbuild_python_deploy_yaml]
# Deploy to Cloud Run
- name: google/cloud-sdk
# args: ['gcloud', 'run', 'deploy', 'helloworld-${SHORT_SHA}',
# '--image=us-central1-docker.pkg.dev/${PROJECT_ID}/${_ARTIFACT_REGISTRY_REPO}/myimage:${SHORT_SHA}',
# '--region', 'us-central1', '--platform', 'managed',
# '--allow-unauthenticated']
args: ['gcloud', 'run', 'deploy', 'personalweb-${SHORT_SHA}',
'--image=australia-southeast1-docker.pkg.dev/${PROJECT_ID}/${_ARTIFACT_REGISTRY_REPO}/myimage:${SHORT_SHA}',
'--region', 'australia-southeast1', '--platform', 'managed',
'--allow-unauthenticated']
# [END cloudbuild_python_deploy_yaml]

# [START cloudbuild_python_logs_yaml]
# Save test logs to Google Cloud Storage
artifacts:
objects:
location: gs://${_BUCKET_NAME}/
paths:
- ${SHORT_SHA}_test_log.xml
# [END cloudbuild_python_logs_yaml]
# Store images in Google Artifact Registry
images:
# - us-central1-docker.pkg.dev/${PROJECT_ID}/${_ARTIFACT_REGISTRY_REPO}/myimage:${SHORT_SHA}
- australia-southeast1-docker.pkg.dev/${PROJECT_ID}/${_ARTIFACT_REGISTRY_REPO}/myimage:${SHORT_SHA}
# [END cloudbuild_python_yaml]
7 changes: 4 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
gunicorn==22.0.0
flask==2.3.2
google-cloud-datastore==1.10.0
google-cloud-logging==1.14.0
flask==3.1.1
pytest==8.3.3
google-cloud-datastore==2.20.1
google-cloud-logging==3.11.3
setproctitle

0 comments on commit a1d7b85

Please sign in to comment.