This repository has been archived on 2024-04-08. You can view files and clone it, but cannot push or open issues or pull requests.
dagger/docs/learn/1006-google-cloud-run.md
Guillaume de Rouville 6f23e9fe2a refacto/doc: remove 'cue init' step from doc
Signed-off-by: Guillaume de Rouville <guillaume.derouville@gmail.com>
2021-09-08 22:31:47 +02:00

1.5 KiB

slug
/1006/google-cloud-run/

Deploy to Google Cloud Run with Dagger

This tutorial illustrates how to use Dagger to build, push and deploy Docker images to Cloud Run.

import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem';

Initialize a Dagger Workspace and Environment

(optional) Setup example app

You will need the local copy of the Dagger examples repository used in previous guides

git clone https://github.com/dagger/examples

Make sure that all commands are being run from the todoapp directory:

cd examples/todoapp

Organize your package

Let's create a new directory for our Cue package:

mkdir gcpcloudrun

Create a basic plan

Set up the environment

Create a new environment

Now that your Cue package is ready, let's create an environment to run it:

dagger new 'gcpcloudrun' -p ./gcpcloudrun

Configure user inputs

dagger input dir src . -e gcpcloudrun
dagger input text deploy.name todoapp -e gcpcloudrun
dagger input text imageRef gcr.io/<your-project>/todoapp -e gcpcloudrun
dagger input text gcpConfig.region us-west2 -e gcpcloudrun
dagger input text gcpConfig.project <your-project> -e gcpcloudrun
dagger input secret gcpConfig.serviceKey -f ./gcp-sa-key.json -e gcpcloudrun

Deploy

Now that everything is set correctly, let's deploy on Cloud Run:

dagger up -e gcpcloudrun