- Lab
-
Libraries: If you want this lab, consider one of these libraries.
- Cloud

Cloud Run Data in GCS and Firestore
In this lab, we'll deploy a basic image gallery app with Cloud Run, and then refactor it so it uses Cloud Storage instead of local file system storage. Then, we'll add the ability to add metadata to images, which we'll store in the Cloud Firestore NoSQL database. You should be familiar with the GCP console and Cloud Shell to perform this hands-on lab. Some experience with Python will be beneficial.

Lab Info
Table of Contents
-
Challenge
Deploy the image-gallery App to Cloud Run
- Download the image-gallery code from the course GitHub repo.
- Build the container image from the
1-local-storage
directory. - Deploy the container to Cloud Run.
- Upload a picture of a dog (any dog will do).
-
Challenge
Refactor the App to Use Cloud Storage
- Create a Cloud Storage bucket for image uploads.
- Refactor the code to use Cloud Storage instead of local storage. You can refer to the updated code in
2-cloud-storage
, or just use the code in that directory instead of updating your own. Don't forget to change the value ofBUCKET_NAME
. - Rebuild the container and deploy the updated version of the app to Cloud Run, using
gcloud run deploy options of --cpu=2 --max-instances=1 --memory=4Gi
. - Re-upload your dog picture.
- Deploy a new revision to force the instance to be removed and recreated. The image you uploaded should persist.
-
Challenge
Deploy the Cloud Firestore Version of the App
- Go to the Cloud Firestore section in the GCP console, and enable Firestore in Native Mode. Choose the us-east1 region.
- Refactor the code to use Cloud Firestore in addition to Cloud Storage. You can refer to the updated code in
3-firestore
, or just use the code in that directory instead of updating your own. - Rebuild the container and deploy the updated version of the app to Cloud Run.
- Upload a dog picture with a description. You should see the image uploaded to Cloud Storage and a document created in Cloud Firestore.
About the author
Real skill practice before real-world application
Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.
Learn by doing
Engage hands-on with the tools and technologies you’re learning. You pick the skill, we provide the credentials and environment.
Follow your guide
All labs have detailed instructions and objectives, guiding you through the learning process and ensuring you understand every step.
Turn time into mastery
On average, you retain 75% more of your learning if you take time to practice. Hands-on labs set you up for success to make those skills stick.