Get startedGet started for free

Develop an app with Gemini assistance

1. Develop an app with Gemini assistance

I'm a developer who needs to build and deploy a simple inventory app to Google Cloud. So let's see how I can use Gemini to be more productive. The first thing I notice is that chatting with Gemini is available right here in my local IDE VS Code, which helps reduce context switching. Now I don't know much about Google Cloud but I do know that my team has standardized on containers. So let's see if Gemini can help me figure out how to build and deploy this app in a container. I love that Gemini's response breaks down tooling and platforms for building and deploying containers packed with just enough information for me to be able to make a decision. Cloud run jumps off the page for me in Gemini's response as I don't want to have to manage any infrastructure so let's go with that. Since I don't know cloud run, I'd actually love an example to use to bootstrap and to stay in context as much as possible. Let's see if Gemini can tell me how to get a Cloud Run app running using Google Cloud's IDE extension Cloud Code. We get step-by-step instructions back from Gemini. So let's step through them. [MUSIC] Okay, looks like I got the sample cloned to my environment and I've landed on a readme page that talks about deployment. But first lets see if Gemini can help me quickly understand the contents of the example. I know containers are often built using a Docker file, and I see one here. So let's actually ask Gemini to break it down. [MUSIC] By highlighting the contents of the Docker file, right-clicking, and selecting Explain this. It looks like Gemini gave me a layer by layer breakdown of what is in the Docker file and I see in Gemini's response that our entry point is actually app py. So let's jump over to see that file and see if Gemini can help us understand the application code. Now, I know there are already comments in the example Docker file, but I was still pretty happy with Gemini's explanation and breakdown. So lets see if it can actually shed some light on the hello function in this flask app. Sweet, with Gemini's explanation, I'm able to quickly learn about the code using natural language, including learning about some useful info that's stored in environment variables that my app can access in Cloud Run. Now, I want to start experimenting with adding inventory functionality to this template. And since I know I'll need to write logic to access inventory data, let's ask Gemini for some sample data. I gave Gemini two specifications that it should be JSON with two specific attributes. And not only was Gemini able to generate this data, but I'm also able to take that data from the Gemini interface and add it directly to this new file in the spirit of speeding up my workflow. Now I'm wondering if Gemini can actually help me write a function to access this data directly from my Flask app. Ill start by modifying my import statements in the flask app for what I think we might need. I read that I can use comments to prompt Gemini to generate code for me, so im going to paste in my requirements, highlighting them and select generate code. Ok I think this is what I wanted. The route looks good, were specifying the get method and were returning the inventory data using jsonify. I guess the next thing to do is test the app out. I'll test it locally first. And since there are some Cloud Run environment variables that we're accessing, I actually want to see if there's a local emulator for Cloud Run. Lets ask Gemini. Yep there is. Now can Gemini tell me how to use it? Just what I needed. Gemini responded with a couple of clear steps to follow to deploy to the cloud run local emulator. So lets follow them. Seems to have completed I think the app is now running and exposed on my local machine at port 8080. Let's open this up in a simple browser, and the app is up and running. I can see that the emulator has specified the cloud run environment variable to be local which makes sense. Now let's see if the code that Gemini gave us to return inventory data is working and it looks good to me. The last thing I want to do is figure out how I can actually deploy this to the cloud in cloud run. And now let's follow Gemini's instructions on how to do this. [MUSIC] Looks like I now have a public URL where I can access the app running in the cloud on cloud run and it looks good to me. To recap, with Gemini I was able to be incredibly productive going from idea to deployment in a platform I was not all too familiar with, all in a matter of minutes and without ever leaving my ide.

2. Let's practice!

Create Your Free Account

or

By continuing, you accept our Terms of Use, our Privacy Policy and that your data is stored in the USA.