# Deploying to Google Cloud Run

> Source: `src/content/docs/deploy/gcp-cloud-run.mdx`
> Canonical URL: https://rivet.dev/docs/deploy/gcp-cloud-run
> Description: Deploy your RivetKit app to Google Cloud Run.

---
## Steps

### Prerequisites

- Google Cloud project with Cloud Run and Artifact Registry enabled
- `gcloud` CLI authenticated (`gcloud auth login`) and project set (`gcloud config set project YOUR_PROJECT`)
- Artifact Registry repository or Container Registry enabled
- Your RivetKit app
  - If you don't have one, see the [Quickstart](/docs/actors/quickstart) page or our [Examples](https://github.com/rivet-dev/rivet/tree/main/examples)
- Access to the [Rivet Cloud](https://dashboard.rivet.dev/) or a [self-hosted Rivet Engine](/docs/general/self-hosting)

### Package Your App

Create a `Dockerfile` in your project root:

```dockerfile
FROM node:20-alpine
WORKDIR /app
COPY package*.json ./
RUN npm ci --omit=dev
COPY . .
ENV PORT=8080
CMD ["node", "server.js"]
```

### Build and Push the Image

Use Cloud Build to build and push the image. Replace the region and repository with your own.

```bash
gcloud builds submit --tag us-central1-docker.pkg.dev/YOUR_PROJECT/rivetkit-app/rivetkit-app:latest
```

### Set Environment Variables

After creating your project on the Rivet dashboard, select Google Cloud Run as your provider. You'll be provided `RIVET_ENDPOINT` and `RIVET_PUBLIC_ENDPOINT` environment variables to use when deploying.

### Deploy to Cloud Run

Deploy the service to Cloud Run, passing the Rivet environment variables. Adjust the region and image as needed.

```bash
gcloud run deploy rivetkit-app \
  --image us-central1-docker.pkg.dev/YOUR_PROJECT/rivetkit-app/rivetkit-app:latest \
  --region us-central1 \
  --allow-unauthenticated \
  --min-instances 1 \
  --set-env-vars RIVET_ENDPOINT=<your-rivet-endpoint>,RIVET_PUBLIC_ENDPOINT=<your-rivet-public-endpoint>
```

### Connect to Rivet

1. After deployment, note the service URL (e.g. `https://rivetkit-app-xxxxx-uc.a.run.app`)
2. On the Rivet dashboard, paste your URL with the `/api/rivet` path into the connect form (e.g. `https://rivetkit-app-xxxxx-uc.a.run.app/api/rivet`)
3. Click "Done"

### Verify

Confirm the service is running:

```bash
gcloud run services describe rivetkit-app --region us-central1 --format 'value(status.conditions[?type="Ready"].status)'
```

Your app should appear as connected on the Rivet dashboard once the service reports ready.

_Source doc path: /docs/deploy/gcp-cloud-run_
