Jekyll allows markdown formatted text to be transformed into static pages. The setup below will generate and deploy a Jekyll site to GCP storage for hosting.
We will deploy this setup to a new GCP project.
1
2
$ PROJECT_ID="my-new-project"
$ gcloud projects create --name ${PROJECT_ID} --set-as-default
Next, lets clone the necessary Dockerfile and entry point script and submit to GCP Build
1
2
3
$ git clone https://github.com/savageb1ts/jekyll-cloud-builder.git
$ cd jekyll-cloud-builder
$ gcloud builds submit --tag gcr.io/${PROJECT_ID}/jekyll-build
Create the necessary bucket to store and serve the static website. This will require that the domain be validated:
1
$ gsutil mb gs://example.com
Navigate to the root of the Jekyll site and create cloudbuild.yaml
with the following contents:
1
2
3
4
5
steps:
- name: gcr.io/$PROJECT_ID/jekyll-build:latest
- name: gcr.io/cloud-builders/gcloud
entrypoint: gsutil
args: ["-m", "rsync", "-r", "-c", "-d", "/workspace/_site", "gs://example.com"]
The cloudbuild.yaml
contains two steps and will be used during the GCP Cloud Build process when a trigger is fired, initiating a build.
Next, we will setup the connect our source code repository and create a trigger to execute the cloud build process.