Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Cookiecutter template for creating Google Cloud Function with python runtime

NotificationsYou must be signed in to change notification settings

idle-code/cookiecutter-gcp-cloud-function-python

Repository files navigation

This script is tailored for deploying 1gen environment functions

Features

  • Environment variables management by pydantic (support for.env.yaml file)
  • Project dependency management via Poetry (pyproject.toml)
  • Uses Flask development server for local testing
  • (Re)Deployment script

Requirements

Usage

$cookiecutter gh:idle-code/cookiecutter-gcp-cloud-function-pythonproject_name [My GCP Cloud Function]:project_slug [my_gcp_cloud_function]:gcp_project []: # Your Google project ID goes here; if empty - your current gcloud configuration will define itSelect gcp_function_region:1 - asia-east12 - asia-east23 - asia-northeast14 - asia-northeast25 - asia-northeast36 - asia-south17 - asia-southeast18 - asia-southeast29 - australia-southeast110 - europe-central211 - europe-west112 - europe-west213 - europe-west314 - europe-west615 - northamerica-northeast116 - southamerica-east117 - us-central118 - us-east119 - us-east420 - us-west121 - us-west222 - us-west323 - us-west4Choose from 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23 [1]:gcp_cloud_function_name [my_gcp_cloud_function]: # This is how function will be named in GCP consolecode_entry_point [on_request_received]: # This is python function name as seen in the source codeSelect memory:1 - 128MB2 - 256MB3 - 512MB4 - 1024MB5 - 2048MB6 - 4096MB7 - 8192MBChoose from 1, 2, 3, 4, 5, 6, 7 [1]:min_auto_scaling_instances [0]:max_auto_scaling_instances [3000]:Select runtime:1 - python3102 - python393 - python384 - python37Choose from 1, 2, 3, 4 [1]:Select timeout:1 - default (1m)2 - 30s3 - 1m4 - 2m5 - 5m6 - 9mChoose from 1, 2, 3, 4, 5, 6 [1]:Select allow_unauthenticated:1 - y2 - nChoose from 1, 2 [1]:author_full_name: Pawel Zukowskiauthor_email: p.z.idlecode@gmail.com$poetry shell$poetry update

Local testing

Enter created directory and execute:

$poetry shell$poetry update$./main.py * Serving Flask app "main" (lazy loading) * Environment: production   WARNING: This is a development server. Do not use it in a production deployment.   Use a production WSGI server instead. * Debug mode: on * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit) * Restarting with stat * Debugger is active!

Deployment

You can use generateddeploy.sh script but double check it for your use case!

About

Cookiecutter template for creating Google Cloud Function with python runtime

Topics

Resources

Stars

Watchers

Forks


[8]ページ先頭

©2009-2025 Movatter.jp