Skip to content

Latest commit

 

History

History
58 lines (37 loc) · 1.72 KB

deploy-to-google.md

File metadata and controls

58 lines (37 loc) · 1.72 KB

Deploy to Google Cloud Platform

Prerequisites

  1. Create a project op Google Cloud Platform
  2. Have access to DNS record of your domain

You can host a static website on a Google Cloud Storage bucket for a domain you own.

The downside to this is that you can only use HTTP. Please follow this tutorial for a HTTP only website

The HTTPS configuration is a bit more complex.

Use a Cloud Storage bucket as a load balancer backend

  1. Configure a Cloud Storage bucket
  2. Configure a load balancing service
  3. Create an external address

Please follow the steps in the well documented Google tutorial

Set main and error page for bucket

gsutil web set -m index.html -e 404.html gs://your-bucket-name

Documentation

Google cloud build

Setup Google Source Repositories

Documentation

Add Build trigger

Create a new trigger

Add a cloudbuild.yaml to the root of the project containing:

steps:
  - name: 'gcr.io/cloud-builders/npm'
    args: ['install']
  - name: 'gcr.io/cloud-builders/npm'
    args: ['run' , 'build']
  - name: 'gcr.io/cloud-builders/gsutil'
    args: ["-m", "rsync", "-r", "-c", "-d", "./dist", "gs://bucket-name"]

Last build step is to push static files to your bucket.

Link DNS record to reserved external Google IP

You must link these to resolve your domain to our external Google IP address. This can be done in your DNS service