I am a newbie to web development. I have followed this tutorial which Firebase team has uploaded on YouTube. Deploy Python on Firebase Hosting with Cloud Run - Firecasts
After deploying my project to Cloud Run, I was able to run it on Firebase Hosting local server https://localhost:5000. I want to change code inside index.html but the local server doesn't reflect the change even after changing the code in editor (VScode) and refreshing the browser. For now, I have to run the following to update the change in the local server but it is really time-consuming.
$gcloud builds submit --tag gcr.io/ projectName / serviceId
$gcloud run deploy serviceId --region us-central1 --platform managed --image gcr.io/ projectName / serviceId
$node_modules/.bin/firebase serve
Is there any way that I could see the change in index.html inside Firebase Hosting local server without running the codes above?
Project Directories
project
---server
---Dockerfile
---src
---app.py
---templates
---index.html
---static
---styles.css
---icons8-pause.png
---firebase.json
---.firebaserc
---package.json
---node_modules
index.html
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Flask + Firebase + CLoud Run = FIRE</title>
<link rel="stylesheet" href="/styles.css">
</head>
<body class="full-screen flex-center">
<h1 class="text-xl">FLASK + Firebase = Awesome + Cool + Nice</h1>
<h2>Hello World</h2>
<a href="/my-link/">Click me</a>
<img src="/icons8-pause.png" alt="">
<h3> {{ context.server_time }}</h3>
</body>
</html>
firebase.json
{
"hosting": {
"public": "static",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"rewrites": [{
"source": "**",
"run": {
"serviceId": "serviceId"
}
}]
}
}
As you are using Firebase Hosting with Cloud Run, unfortunately, it's necessary to use these commands, as you need to containerize the app and upload it to Container Registry, so it can be deployed. For example, even in this simple Hello World
example, it needs to have the commands run.
To summarize, considering the structure and format of your application - deploying with Cloud Run - it will be needed for you to execute the commands, so the application is containerized and uploaded properly, so the deploy occurs correctly. You can get all the details via official documentation here as well.