Cloud Run tutorial (python)

Preparation

Check locally

Move directory. cd python-docs-samples/run/system-package

Build the docker image. docker build --tag graphviz:python .

Start the container. docker run --rm -p 9090:8080 -e PORT=8080 graphviz:python

Access the URL below and check that the image is displayed. (There is a space, but you can leave it as it is) https://localhost:9090/diagram.png?dot=digraph Run { rankdir=LR Code -> Build -> Deploy -> Run }

Confirmed on GCP

#project
export GOOGLE_CLOUD_PROJECT=<PROJECT_ID>
#Raise the container to GCR
gcloud builds submit --tag gcr.io/${GOOGLE_CLOUD_PROJECT}/graphviz
#Deploy to Cloud Run
gcloud beta run deploy graphviz --image gcr.io/${GOOGLE_CLOUD_PROJECT}/graphviz

You can choose which GCP product to use when deploying, but this time select Cloud Run full managed. Since the URL published in the log is displayed, access the following URL based on it and check that the same image as when trying locally is displayed.

https://<SERVICE_DOMAIN>/diagram.png?dot=digraph Run { rankdir=LR Code -> Build -> Deploy -> Run }

You can also check the deployed endpoints from the Cloud Run management screen of the GCP console.

Clean up

If this is left as it is, the deployed application will continue to run and it will cost money, so delete it. You can delete the endpoint from the Cloud Run management screen, so delete it. Also, if there is a repository on GCR (Google Container Registry), you may be charged for storage, so delete that as well if you are concerned.

Impressions

I misunderstood that it was for a more complicated environment, but in the tutorial, I found it convenient to easily execute and release even a small application with only a Dockerfile and a single script. Since the environment can be set freely with the Dockerfile, if you want to finely modify the environment where the application is placed, or If you want to use it other than GCP, that is, if you are assuming multi-cloud, I thought that Cloud Run would be good. However, if you are accustomed to GAE, I feel that GAE 2nd is almost done.

Recommended Posts

Cloud Run tutorial (python)
Python tutorial
Run XGBoost with Cloud Dataflow (Python)
Python Django Tutorial (5)
Python Django Tutorial (8)
Python Django Tutorial (6)
Python Django Tutorial (7)
Python Django tutorial tutorial
Python Django Tutorial (3)
Python Django Tutorial (4)
Run Cloud Dataflow (Python) from App Engine
[Docker] Tutorial (Python + php)
Python Django tutorial summary
Run Python with VBA
Run prepDE.py with python3
Run python from excel
Run Blender with python
Python OpenCV tutorial memo
Run iperf with python
Run Python from Excel VBA with xlwings & tutorial supplement
Run python with PyCharm (Windows)
[Python tutorial] Control structure tool
Run Python with CloudFlash (arm926ej-s)
Run automatic jobs in python
Let's run Excel with Python
Run Python unittests in parallel
Run illustrator script from python
Run Tensorflow 2.x on Python 3.7
[Python] Decision Tree Personal Tutorial
Run Python CGI on CORESERVER
Run unix command on python
How to run Notepad ++ Python
Run Label with tkinter [Python]
Python Django Tutorial Cheat Sheet
Run DHT22 with RasPi + Python
Get Python scripts to run quickly in Cloud Run using responder
EEG analysis in Python: Python MNE tutorial
[Package cloud] Manage python packages with package cloud
Python
Run shell command / python in R
Run Rotrics DexArm with python API
Build a detonation velocity website with Cloud Run and Python (Flask)
Run TensorFlow Docker Image on Python3
Using Cloud Storage from Python3 (Introduction)
Run Aprili from Python with Orange
Run python3 Django1.9 with mod_wsgi (deploy)
Python error detection run from Powershell
Have cron run Python under pyvenv
Run Python scripts synchronously from C #
Run unittests in Python (for beginners)
Run Ansible from Python using API
Run a simple algorithm in Python
Run Python Scripts from Cisco Memorandum_EEM
Periodically run Python on Heroku Scheduler
[Python Tutorial] An Easy Introduction to Python
Google Cloud Vision API sample for python
Use Tabpy with Cloud Run (on GKE)
Gulp task runner to run python nosetests
[Python] Run Flask on Google App Engine
Try using Python with Google Cloud Functions
Recommendation tutorial using association analysis (python implementation)