Skip to content

tu-sec/hosting-workshop

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 

Repository files navigation

Hosting Demo

This demo covers how to host a frontend application using Firebase and the Google Cloud Platform (GCP). In it, you will see files for deploying to Firebase and also the Dockerfile that is needed to deploy to GCP's Cloud Run service.

Requirements

You will need to download and install the following:

  1. NodeJS
  2. Docker
  3. gcloud CLI

NodeJS is 100% required for this demo. Docker and the GCloud CLI are only required if you would like to learn how to professionally deploy your app as a docker container. This will be the second half of the demo.

Firebase Deployment

Steps:

  1. Go to the firebase console and create a new project
  2. Install the firebase CLI
$ npm i -g firebase-tools
  1. Log in to the firebase CLI
$ firebase login
  1. Navigate to the 'sample' directory in the terminal and run the following
$ firebase init
  1. Place all of your code in the 'public' folder

  2. After configuring the project, run the following

$ firebase deploy

Cloud Run Deployment

Steps:

  1. Create a nginx Docker file
  2. Build the image (assuming in the 'sample' directory)
$ docker build -t gcr.io/$PROJECT_ID/client .

Note that the $PROJECT_ID is the ID of the google cloud platform project. This project is automatically created when you create a firebase application.

  1. Push the new image to GCP's container registry
$ docker push gcr.io/$PROJECT_ID/client
  1. Deploy the container to Cloud Run
$ gcloud run deploy client --image gcr.io/$PROJECT_ID/client --region us-central1 --platform managed

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published