Google Cloud Platform: App Engine Demo with Express.js and Pug
Author: C. Crerar
This is a demo of the usage of Google Cloud Platform
App Engine Service.
It is a mobile first
application that uses Node.js
version of the service and sports a custom Express.js
application that implements pug
as the view engine.
Along with this it also implements a CI/CD
pipeline that automatically re-deploys the application after passing as series of tests.
NOTE: This instruction assumes that a
google cloud platform
billing account
is registered with an existingproject
. To run this container in google cloud platform requires agcp project id
id to exist prior to following the below instructions. To get started with google cloud platform please visit google cloud platform.
Prerequisites:
If the SDK is installed run gcloud config
and follow the prompts. (note: you first need a google cloud account for this to work.)
see cloudbuild.yaml
Set the below in the package.json
"submit": "gcloud builds submit --tag gcr.io/[PROJECT-ID]/[IMAGE]",
"deploy":"gcloud run deploy express --image gcr.io/[PROJECT-ID]/[IMAGE]"
Replace [PROJECT-ID]
and [IMAGE]
with the google cloud project name and the desired image name.
Building the container using cloud build
npm run submit
Deploying the built container
npm run deploy
container registry
docker build . --tag gcr.io/[PROJECT-ID]/[IMAGE]
Replace [PROJECT-ID]
with your Google Cloud project ID and replace [IMAGE]
with the image name of your choice.
If you have not yet configured Docker to use the gcloud command-line tool to authenticate requests to Container Registry, do so now using the command:
gcloud auth configure-docker
You need to do this before you can push or pull images using Docker. You only need to do it once.
Push the container image to Container Registry:
docker push gcr.io/[PROJECT-ID]/[IMAGE]
Replace [PROJECT-ID]
with your Google Cloud project ID and replace [IMAGE]
with the image name you chose when you invoked docker build.