While deploying a web app like React, Angular or Node projects using Google cloud, you might come across this error after pushing your app from a docker container to gcr.io (Google cloud repository)
After tracing the logs, i realised its a platform related problem and you must have built your docker image using the code below;
docker build -t {project-name} .
The code above works well on an intel system when you push to Google Cloud. but not on Apples M1, sadly ๐
You will get an error saying:
Cloud Run: “Failed to start and then listen on the port defined by the PORT environment variable.”
this happens when building on Cloud run
![cloud run issue environment variable](https://vincenttechblog.com/wp-content/uploads/2022/07/cloud-run-port-environment-variable-error-1030x496.png)
Solution to the Cloud run Failed to start issue
Use the following command to build your docker image;
docker buildx build --platform linux/amd64 -t {project-name} .
Voila! ๐
Watch how to Deploy a React app on Cloud run
Leave a Reply