Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added buildfile and updated components. #43

Merged
merged 1 commit into from
Dec 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading