GCP Service Used : Cloud Storage
1. Create a project in GCP
2. Under that project, go to view all services. Look for
Storage > Cloud > Buckets
3. Create New Bucket named as test_gcp-01
Select Location-Type as Multi-region
4. Choose all the by default setting and Create
5. Confirm the public access prevention
6. Upload or drag build folder files. If react app, run these commands to get production code
npm install
npm run build
7. Create a new file named as app.yaml and placed under src folder of the project.runtime: nodejs10
handlers:
#Serve all static files with urls ending with a file extension
- url: /(.*\..+)$
static_files: build/\1
upload: build/(.*\..+)$
#catch all handler to index.html
- url: /.*
static_files: build/index.html
upload: build/index.html
8. Upload the app.yaml to the bucket
9. The final uploads looks like:
10. Activate Cloud Shell from the top bar placed near to search bar
Write following commands: gcloud config set project your-project-name
mkdir react-app
gsutil rsync -r gs://gcp.shagun.dev ./react-app
cd react-app
gcloud app deploy
11. Please check Deployed service in the screenshot, copy the given link and paste it to browser
12. Your website got live !