Deploy Sapper on Google Cloud Run

  • Exporting -: By running npm export on the root, it will generate a bunch of static files and now upload those to any web server, link domain and it will run.
  • Running Server -: By running npm run buildit will generate production build and then run npm run startwhich will start serving those build files you made. So we will be doing same thing on our Cloud Run and serve them. Here are some steps we will be doing -:
  1. Dockerization -: As we will deploying docker container so we need to dockerize our app so create a file called Dockerfile in root.
# Use the official lightweight Node.js 12 image.# https://hub.docker.com/_/nodeFROM node:12-slim# 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 / ./# Install dependencies.RUN npm install# Compile to productionRUN npm run buildEXPOSE 8080# Run the web service on container startup.CMD [ "npm", "start" ]

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store