Skip to Content
Technical Articles
Author's profile photo Nabheet Madan

CAPM meet Google Cloud Run – Serverless Containers


Lucia Subatin (your blog helped a lot,thanks) recently blogged about using Google Cloud Run(GCR) with HANA. This is what got me into digging more into what is GCR? Can we do something about it? On digging further found out that GCR is deploys serverless containers with super ease. There is also an option to use it with Google Kubernetes Engine(GKE). In the past we have already deployed our SAPUI5 app to the Kubernetes engine but all manually, so thought of trying this. Read on!

What we are trying to do?

We have been try to get out hand dirty with Cloud Application Programming Model(CAPM) thanks to qmacro and his hands on SAP Dev session. I thought of deploying our CAPM based app to GCR and see how it work out. So in the next steps we will try to deploy our CAPM based app to GCR.


Lets begin

Google Cloud Platform provides with a free account with credits sufficient enough to perform this POC. At a higher level we will be performing the steps shown below.

  • Lets first activate our Google Cloud shell so that we can create our CAPM based application.

  • Next step is to create our CAPM app which talks to a sqlite backend by following this tutorial.

  • So as can we see we can see our app running locally in GCP

  • Next step is to make a docker image via Dockerfile and deploy via cloud build. As can be seen below we are using the stand Node image and on top of it building layers of our application. This was one of the tricky parts as while deploying the image to container it was not recognising CDS command, that is why as an alternative i have to use the directory path. This might change or revise if i find a better way!
FROM node:10
# Create and change to the app directory.
WORKDIR /usr/src/app
# Copy application dependency manifests to the container image.
# A wildcard is used to ensure both package.json AND package-lock.json are copied.
# Copying this separately prevents re-running npm install on every code change.
COPY package.json package*.json ./
COPY .npmrc ./
# Install production dependencies.
RUN npm install
# Copy local code to the container image.
COPY . .
# Run the web service on container startuip
RUN ./node_modules/@sap/cds/bin/cds.js deploy --to sqlite:db/my-bookshop.db
CMD ["./node_modules/@sap/cds/bin/cds.js","run"]


  • Now the next step was to build the container image by using below mentioned command.
gcloud builds submit --tag


  • Lets now deploy the image to the GCR check the demo below.
gcloud  beta run deploy  --image

Final Results

What is next?

Since we have already now an app running with sqllite as backend, we will explore further how can we have it with HANA as backend along with a frontend also deployed:)

Some troubleshooting tips

  • While creating the Image sometimes the creation fails it can be due to syntax error or any other reason. So in those case you can navigate to cloud build as shown below and click on the image name to see the logs

  • On a similar line while deploying the image to container you can get certain errors in order to see the detail you need to go to cloud run and choose your service and see details as shown below.

Assigned Tags

      You must be Logged on to comment or reply to a post.
      Author's profile photo Lucia Subatin
      Lucia Subatin

      Nice experiment, Nabheet!

      Author's profile photo Nabheet Madan
      Nabheet Madan
      Blog Post Author

      Thanks Lucia?