본문으로 건너뛰기
Skillpedia
배포 및 클라우드 (DevOps)33k · #8738

cloud-run-basics

하는 일

이 스킬은 서버를 직접 관리하지 않고 코드를 실행하는 플랫폼인 Google Cloud Run의 사용법을 설명하고 안내합니다. Google Cloud에서 앱을 만들거나 호스팅하는 사람을 위한 스킬입니다.

사용하는 경우

  • ✓웹 앱이나 API를 Google Cloud Run에 올리고 싶을 때.
  • ✓작업을 일정에 따라 실행하거나 한 번 요청해서 실행해야 할 때.
  • ✓큐에서 읽어 오며 항상 실행되어야 하는 백그라운드 워커가 있는 경우.

스킬 링크

https://github.com/davila7/claude-code-templates/blob/main/cli-tool/components/skills/development/cloud-run-basics/SKILL.md

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/davila7/claude-code-templates/blob/main/cli-tool/components/skills/development/cloud-run-basics/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“제 웹 앱을 Google Cloud Run에 배포해서 인터넷에서 볼 수 있게 해 주세요.”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

이 스킬은 필요한 Google Cloud 서비스를 활성화하고 접근 역할을 설정하는 단계를 안내한 뒤, 서비스, 작업, 워커 풀 중 하나의 리소스 유형을 만들도록 돕습니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.

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

  1. Enable the Cloud Run Admin API and Cloud Build APIs:

    gcloud services enable run.googleapis.com cloudbuild.googleapis.com --quiet
    
  2. If you are under a domain restriction organization policy restricting unauthenticated invocations for your project, you will need to access your deployed service as described under Testing private services.

Required roles

You need the following roles to deploy your Cloud Run resource:

  • 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

Cloud Build automatically uses the Compute Engine default service account as the default Cloud Build service account to build your source code and Cloud Run resource, unless you override this behavior.

For Cloud Build to build your sources, grant the Cloud Build service account the Cloud Run Builder (roles/run.builder) role on your project:

gcloud projects add-iam-policy-binding PROJECT_ID \
    --member=serviceAccount:SERVICE_ACCOUNT_EMAIL_ADDRESS \
    --role=roles/run.builder \
    --quiet

Replace PROJECT_ID with your Google Cloud project ID and SERVICE_ACCOUNT_EMAIL_ADDRESS with the email address of the Cloud Build service account.

Deploy a Cloud Run service

You can deploy your service to Cloud Run by using a container image or deploy directly from source code using a single Google Cloud CLI command.

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 to Cloud Run

Cloud Run imports your container image during deployment. Cloud Run keeps this copy of the container image as long as it is used by a serving revision. Container images are not pulled from their container repository when a new Cloud Run instance is started.

Supported container images

You can directly use container images stored in the Artifact Registry, or Docker Hub. Google recommends the use of Artifact Registry since Docker Hub images are cached for up to one hour.

You can use container images from other public or private registries (like JFrog Artifactory, Nexus, or GitHub Container Registry), by setting up an Artifact Registry remote repository.

You should only consider Docker Hub for deploying popular container images such as Docker Official Images or Docker Sponsored OSS images. For higher availability, Google recommends deploying these Docker Hub images using an Artifact Registry remote repository.

To deploy a container image, run the following command:

    gcloud run deploy SERVICE_NAME \
        --image IMAGE_URL \
        --region us-central1 \
        --allow-unauthenticated \
        --quiet

Replace the following:

  • SERVICE_NAME: the name of the service you want to deploy to. Service names must be 49 characters or less and must be unique pe
자주 묻는 질문

서비스와 작업의 차이는 무엇인가요?

서비스는 고정 주소에서 웹 요청에 응답하고, 작업은 완료될 때까지 실행되며 요청하거나 일정에 따라 실행됩니다.

워커 풀은 무엇에 쓰나요?

메시지를 가져오는 큐 소비자처럼 항상 실행되는 백그라운드 작업용입니다.

배포 전에 활성화해야 할 것이 있나요?

네. 프로젝트에서 Cloud Run Admin API와 Cloud Build API를 활성화해야 합니다.

상세 정보

작성자의 원본 설명

Manages Cloud Run services, jobs, and worker pools. Use when you need to deploy applications responding to HTTP requests (services), run event-triggered or scheduled tasks (jobs), or handle always-on pull-based background processing (worker pools).

repo: davila7/claude-code-templates

인기도

GitHub 스타
33k
순위
#8738
라이선스
MIT
업데이트
2026. 11. 2.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬