cloud-run-basicslisted
Install: claude install-skill martineserios/thebrana
# Cloud Run Basics
Cloud Run is a fully managed application platform for running your code,
function, or container on top of Google's highly scalable infrastructure. It
abstracts away infrastructure management, providing three primary resource
types:
1. **Services:** Responds to HTTP requests sent to a unique and stable
endpoint, using stateless instances that autoscale based on a variety of key
metrics, also responds to events and functions.
2. **Jobs:** Executes parallelizable tasks that are executed manually, or on a
schedule, and run to completion.
3. **Worker pools:** Handles always-on background workloads such as pull-based
workloads, for example, Kafka consumers, Pub/Sub pull queues, or RabbitMQ
consumers.
## Prerequisites
Enable the Cloud Run Admin API and Cloud Build APIs:
```bash
gcloud services enable run.googleapis.com cloudbuild.googleapis.com
```
### Required roles
- Cloud Run Admin (`roles/run.admin`) on the project
- Cloud Run Source Developer (`roles/run.sourceDeveloper`) on the project
- Service Account User (`roles/iam.serviceAccountUser`) on the service identity
- Logs Viewer (`roles/logging.viewer`) on the project
## Deploy a Cloud Run service
> **CRITICAL RULE:** Any deployed code MUST listen on 0.0.0.0 (not 127.0.0.1)
> and use the injected $PORT environment variable (defaults to 8080), or it will
> crash on boot.
### Deploy a container image
```bash
gcloud run deploy SERVICE_NAME \
--image IMAGE_URL \
--region