Vendure eCommerce on Google Cloud Run

For my company I decided to build a SaaS eCommerce platform, to hold multiple webshops. After doing some research I stumbled upon, a headless eCommerce framework written in NodeJS with a GraphQL API. What more could you want?

For scalability and cost reduction I am running Vendure on Google Cloud Run, here is how to do it!

⚠️There is an updated version of this tutorial here:

Minimal effort

This blog describes the minimal steps to deploy Vendure to Cloud Run. More improvements are possible. I have described them at the end of this blog.

What needs to be done

  • Vendure uses local file system to store assets. Cloud Run doesn’t have persistent local file system
  • Listen to the correct Cloud Run port
  • A MySQL database for Vendure
  • Dockerize the application
  • Deploy to Google Cloud Run

Google Storage

We need to make Vendure use Google Storage instead of local file system. Luckily it’s very easy to implement your own AssetStorageStrategy.

This file shows you how to implement Google Storage.

Configure port

Make sure the Vendure app listens to the correct port on Cloud Run. Add this to you vendure-config.ts :

apiOptions: {
port: process.env.PORT || 3000

This will listen to the PORT variable if defined by Google, or port 3000 when running locally.

MySQL database

For the MySQL database I use CloudSQL, which is Google’s managed MySQL solution.

  • Create a database and user. Save the host, username, password and database name
  • Set the host, username, password and databasename in vendure-config.ts :
dbConnectionOptions: {
type: ‘mysql’,
synchronize: true,
logging: false,
username: DATABASE_USER,
database: DATABASE_NAME,

Remember to set synchronize: false after the initial startup, to prevent possible data loss later.

Dockerize the application

We need to Dockerize our Vendure app to deploy it to Cloud Run.

First, create a Dockerfile :



# A wildcard is used to ensure both package.json AND package-lock.json are copied
package*.json ./

npm ci --only=production

# Bundle app source
. .

# Run the web service on container startup.
[ "npm", "start"]

Run the following commands in the root folder of your project to build the Docker container and upload it to Google’s container registry (GCR):

docker build -t .
# Configure docker to use Google authentication
gcloud auth configure-docker -q


Deploy the created container to Cloud Run:

gcloud run deploy shops-test \
--quiet \
--image "" \
--region "europe-west1" \
--platform "managed" \
--allow-unauthenticated \


To make you Vendure setup even more production worthy:

For the complete project:

Am I missing something? let me know!

Pinelab specializes in static websites, webshops, and backend development using NodeJS and GraphQL. Visit or leave a comment here.

Fullstack developing for the web, check out for more!