Alessandro Ceccarelli
Alessandro Ceccarelli

Reputation: 1945

Specify Python version on Cloud Run Buildpack

I am deploying a web app on Cloud Run using the automated Cloud Build "Buildpack" option (as explained here); hence not having to create a Docker File.

I would like to deploy the app using python-3.8.12 and buildpacks. How can I specify that?

Upvotes: 3

Views: 2104

Answers (2)

Osvaldo
Osvaldo

Reputation: 519

There’s no need to specify it. The builder attempts to autodetect the language of your source code and Python 3.7+ is one of the supported languages.

You may try this Python buildpacks sample.

You can also find out deeper information about buildpacks in this presentation.

Update

As an alternative, you can also manually specify which buildpack to use, thereby skipping the auto-detection step. As described in this answer, you can also specify it in the project.toml the following way:

[[build.env]] 
name = "GOOGLE_RUNTIME_VERSION" 
value = "3.8.6"

This would be the same as what you'd put in the .python-version, but would take precedence over it.

Upvotes: 0

Alessandro Ceccarelli
Alessandro Ceccarelli

Reputation: 1945

You only need to add .python-version file to your repository, in which the Python version is reported as:

3.8.6

Upvotes: 6

Related Questions