{"id":30626062,"url":"https://github.com/mootoday/sapper-on-cloud-run","last_synced_at":"2025-10-26T09:46:00.303Z","repository":{"id":38244558,"uuid":"259427681","full_name":"mootoday/sapper-on-cloud-run","owner":"mootoday","description":"A boilerplate to deploy Sapper (Svelte) applications to Cloud Run (https://cloud.run)","archived":false,"fork":false,"pushed_at":"2023-01-06T04:29:36.000Z","size":488,"stargazers_count":10,"open_issues_count":22,"forks_count":3,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-05-02T00:14:06.752Z","etag":null,"topics":["cloudbuild","cloudrun","google-cloud-platform","sapper","svelte"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mootoday.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-04-27T19:11:24.000Z","updated_at":"2024-05-02T00:14:06.753Z","dependencies_parsed_at":"2023-02-05T07:46:08.082Z","dependency_job_id":null,"html_url":"https://github.com/mootoday/sapper-on-cloud-run","commit_stats":null,"previous_names":["mootoday/sapper-on-cloud-run"],"tags_count":0,"template":true,"template_full_name":null,"purl":"pkg:github/mootoday/sapper-on-cloud-run","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mootoday%2Fsapper-on-cloud-run","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mootoday%2Fsapper-on-cloud-run/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mootoday%2Fsapper-on-cloud-run/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mootoday%2Fsapper-on-cloud-run/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mootoday","download_url":"https://codeload.github.com/mootoday/sapper-on-cloud-run/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mootoday%2Fsapper-on-cloud-run/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272892459,"owners_count":25010791,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-30T02:00:09.474Z","response_time":77,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cloudbuild","cloudrun","google-cloud-platform","sapper","svelte"],"created_at":"2025-08-30T18:38:59.322Z","updated_at":"2025-10-26T09:46:00.201Z","avatar_url":"https://github.com/mootoday.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Gitpod Ready-to-Code](https://img.shields.io/badge/Gitpod-Ready--to--Code-blue?logo=gitpod)](https://gitpod.io/#https://github.com/mikenikles/sapper-on-cloud-run) \n\n# sapper-on-cloud-run\nA boilerplate to deploy Sapper (Svelte) applications to Cloud Run (https://cloud.run)\n\nA demo is available at https://sapper-on-cloud-run.mikenikles.com/.\n\n## Blog posts\n\nTwo corresponding blog posts are available with details:\n* [Sapper, Google Cloud Run, Continuous Deployment - A boilerplate template](https://www.mikenikles.com/blog/sapper-google-cloud-run-continuous-deployment-a-boilerplate-template)\n* [Firebase Hosting for static assets of a Sapper web app on Cloud Run](https://www.mikenikles.com/blog/firebase-hosting-for-static-assets-of-a-sapper-web-app-on-cloud-run)\n    * Also check [PR #5](https://github.com/mikenikles/sapper-on-cloud-run/pull/5)\n\n## Docker local testing\n\nThe following NPM scripts assist with testing the container image locally:\n* `npm run dev:docker:build`: Builds the docker image.\n* `npm run dev:docker:run`: Runs the docker image locally on port 3000.\n\n## Set up the Artifact Registry\n\n```sh\n# Enable the Artifact Registry API\ngcloud services enable artifactregistry.googleapis.com\n\n# Create an Artifact Registry repository to host docker images\ngcloud beta artifacts repositories create docker-repository --repository-format=docker \\\n--location=us-central1\n```\n\n## Set up Cloud Build\n\n```sh\n# Enable the Cloud Build API\ngcloud services enable cloudbuild.googleapis.com\n\n# Create a build trigger\ngcloud beta builds triggers create github \\\n--repo-name=sapper-on-cloud-run \\\n--repo-owner=mikenikles \\\n--branch-pattern=\"^master$\" \\\n--build-config=cloudbuild.yaml\n```\n\n## Set up Cloud Run\n\n```sh\n# Obtain the numeric project ID\n# Use: gcloud projects list --filter=\"$(gcloud config get-value project)\" --format=\"value(PROJECT_NUMBER)\"\n\n# Grant the Cloud Run Admin role\ngcloud projects add-iam-policy-binding $PROJECT_ID \\\n  --member \"serviceAccount:PROJECT_NUMBER@cloudbuild.gserviceaccount.com\" \\\n  --role roles/run.admin\n\n# Grant access to Cloud Build to deploy to Cloud Run\ngcloud iam service-accounts add-iam-policy-binding \\\n  PROJECT_NUMBER-compute@developer.gserviceaccount.com \\\n  --member=\"serviceAccount:PROJECT_NUMBER@cloudbuild.gserviceaccount.com\" \\\n  --role=\"roles/iam.serviceAccountUser\"\n```\n\n*Note:* If you have not enabled compute engine, you will see an error like: \n\n\u003e Gaia id not found for email PROJECT_NUMBER-compute@developer.gserviceaccount.com\n\n_where PROJECT_NUMBER is the actual number. To solve this, simply visit the compute engine service and allow the initial setup to complete. This will create the service account called PROJECT_NUMBER-compute@developer.gserviceaccount.com and after that, the iam command will run successfully._\n\n## Deploy to Cloud Run\n\nCloud Run (https://cloud.run) is a fully managed serverless compute platform that automatically\nscales your stateless containers.\n\nThe continuous deployment pipeline works as follows:\n1. Merge a pull request into the `master` branch.\n1. The [Cloud Build GitHub app](https://github.com/marketplace/google-cloud-build) triggers Cloud Build to:\n    1. Build the docker image\n    1. Push the docker image to [Artifact Registry](https://cloud.google.com/artifact-registry)\n    1. Deploy the image to [Cloud Run](https://cloud.google.com/run)\n\n### Mapping a custom domain\n\nDetails on how to verify a domain can be found [in the documentation](https://cloud.google.com/run/docs/mapping-custom-domains).\n\nOnce a domain is verified, the following command maps it to a Cloud Run service:\n\n```sh\ngcloud beta run domain-mappings create \\\n  --service sapper-on-cloud-run \\\n  --domain sapper-on-cloud-run.mikenikles.com \\\n  --region us-central1 \\\n  --platform managed\n```\n\nAdd a CNAME record with name `sapper-on-cloud-run` and contents `ghs.googlehosted.com` to your DNS.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmootoday%2Fsapper-on-cloud-run","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmootoday%2Fsapper-on-cloud-run","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmootoday%2Fsapper-on-cloud-run/lists"}