함수 소스 코드를 Cloud Run Functions에 배포하면 이 소스 코드는 Cloud Storage 버킷에 저장됩니다. 그러면 Cloud Build에서 코드를 컨테이너 이미지에 자동으로 빌드하고 이 이미지를 Artifact Registry 이미지 레지스트리로 내보냅니다.
Cloud Run Functions는 함수를 실행하려면 컨테이너를 실행해야 하는 경우에 이 이미지에 액세스합니다.
다음 다이어그램에서 Cloud Run Functions 상자는 Cloud Run Admin API 또는 Cloud Functions API를 사용하여 Cloud Run에 배포된 함수를 나타냅니다. 일반적으로 최신 함수는 Cloud Run Admin API를 통해 배포되고 이전 함수는 Cloud Functions API를 통해 배포됩니다.
그림 1. 사용자가 함수 소스 코드를 준비하여 Cloud Run에 배포합니다.
함수를 배포할 때 사용되는 API에 따라 다음이 발생합니다.
Cloud Run Admin API를 사용하여 함수를 배포한 경우 다음이 발생합니다.
소스 코드는 보관 기간이 없는 Cloud Storage 버킷에 업로드됩니다.
기본 암호화를 사용하는 경우 버킷 이름이 자동 생성되며 이름은 run-sources-PROJECT_ID-REGION입니다.
고객 관리 암호화 키(CMEK)로 데이터를 보호하는 경우에는 버킷 이름이 자동 생성되지 않으므로 버킷 이름을 제공해야 합니다.
소스 코드는 Cloud Build에 제출되며 여기에서 Google Cloud 빌드팩과 함수 프레임워크가 컨테이너 이미지를 만듭니다. Cloud Build 서비스 계정에서 컨테이너 이미지를 빌드합니다.
그러면 REGION-docker.pkg.dev/PROJECT_ID/cloud-run-source-deploy라는 자동 생성 버킷을 통해 컨테이너 이미지가 Artifact Registry에 업로드됩니다.
이미지는 Cloud Run에 서비스로 배포됩니다.
Eventarc, Pub/Sub 또는 기타 HTTP 트리거를 사용하여 함수를 트리거하거나 호출할 수 있습니다.
Cloud Functions API(v2)를 사용하여 함수를 배포한 경우 다음이 발생합니다.
소스 코드는 보관 기간이 없는 Cloud Storage 버킷에 업로드됩니다.
버킷 이름이 자동 생성되며 다음 형식을 따릅니다.
기본 암호화를 사용하는 경우 이 버킷의 이름은 gcf-v2-sources-PROJECT_NUMBER-REGION입니다.
CMEK로 데이터를 보호하는 경우 버킷 이름은 gcf-sources-PROJECT_NUMBER-REGION-CMEK_KEY_HASH입니다.
소스 코드는 Cloud Build에 제출되며 여기에서 Google Cloud 빌드팩과 함수 프레임워크가 컨테이너 이미지를 만듭니다. Cloud Build 서비스 계정에서 컨테이너 이미지를 빌드합니다.
그러면 REGION-docker.pkg.dev/PROJECT_ID/gcf-artifacts라는 자동 생성 버킷을 통해 컨테이너 이미지가 Artifact Registry에 업로드됩니다.
이미지는 Cloud Run에 서비스로 배포됩니다.
Eventarc, Pub/Sub 또는 기타 HTTP 트리거를 사용하여 함수를 트리거하거나 호출할 수 있습니다.
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["이해하기 어려움","hardToUnderstand","thumb-down"],["잘못된 정보 또는 샘플 코드","incorrectInformationOrSampleCode","thumb-down"],["필요한 정보/샘플이 없음","missingTheInformationSamplesINeed","thumb-down"],["번역 문제","translationIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2025-08-18(UTC)"],[],[],null,["# Cloud Run functions overview\n\nThis guide provides an introductory overview of how other Google Cloud services\nare involved in the Cloud Run functions deployment process.\n\nBefore you begin\n----------------\n\nFamiliarize yourself with Cloud Run functions and source deployment\nconcepts from the\n[Cloud Run deployment options and resource model](/run/docs/resource-model)\nguide.\n\nArchitecture overview\n---------------------\n\nWhen you deploy your function's source code to Cloud Run functions,\nthat source code is stored in a Cloud Storage bucket. Cloud Build then\nautomatically builds your code into a container image and pushes that image to\nan Artifact Registry [image registry](/run/docs/deploy-functions#image-repository).\nCloud Run functions accesses this image when it needs to run the\ncontainer to execute your function.\n\nIn the following diagram, the Cloud Run functions box represents\na function that is deployed in Cloud Run, using either the\nCloud Run Admin API or the Cloud Functions API. Typically, newer functions\nare deployed using the Cloud Run Admin API, and older functions are deployed\nusing the Cloud Functions API.\n**Figure 1.** A user prepares functions source code and deploys it to Cloud Run.\n\nDepending on which API is used when deploying a function, the following occurs:\n\n- If you deployed your function using use the *Cloud Run Admin API*, the\n following occurs:\n\n 1. Your source code is uploaded to a Cloud Storage bucket that has no\n retention period.\n\n 1. If you're using default encryption, the name of the bucket is autogenerated and named `run-sources-`\u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e`-`\u003cvar translate=\"no\"\u003eREGION\u003c/var\u003e.\n 2. If you're protecting your data with [Customer-managed encryption keys (CMEK)](/kms/docs/cmek), the bucket name is not autogenerated, and you must provide a bucket name.\n 2. The source code is submitted to Cloud Build, where\n Google Cloud's buildpacks and the Functions Framework create a container\n image. Note that the Cloud Build service account builds the container\n image. Cloud Run defaults to using the\n [`e2-standard-2` machine type](/build/pricing)\n provided by Cloud Build.\n\n 3. Your container image is then uploaded to Artifact Registry through an auto-created\n bucket called \u003cvar translate=\"no\"\u003eREGION\u003c/var\u003e`-docker.pkg.dev/`\u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e`/cloud-run-source-deploy`.\n\n 4. The image is deployed to Cloud Run as a service.\n\n 5. You can trigger or invoke the function with Eventarc,\n Pub/Sub, or other HTTP triggers.\n\n- If you deployed your function using use the *Cloud Functions API (v2)*, the\n following occurs:\n\n 1. Your source code is uploaded to a Cloud Storage bucket that has no\n retention period.\n\n The name of the bucket is autogenerated and follows this format:\n 1. If you're using default encryption, this bucket is named `gcf-v2-sources-`\u003cvar translate=\"no\"\u003ePROJECT_NUMBER\u003c/var\u003e`-`\u003cvar translate=\"no\"\u003eREGION\u003c/var\u003e.\n 2. If you're protecting your data with CMEK, the bucket is named `gcf-sources-`\u003cvar translate=\"no\"\u003ePROJECT_NUMBER\u003c/var\u003e`-`\u003cvar translate=\"no\"\u003eREGION\u003c/var\u003e`-`\u003cvar translate=\"no\"\u003eCMEK_KEY_HASH\u003c/var\u003e.\n 2. The source code is submitted to Cloud Build, where\n Google Cloud's buildpacks and the Functions Framework create a container\n image. Note that the Cloud Build service account builds the container\n image. Cloud Run defaults to using the\n [`e2-standard-2` machine type](/build/pricing)\n provided by Cloud Build.\n\n 3. Your container image is then uploaded to Artifact Registry through an auto-created\n bucket called \u003cvar translate=\"no\"\u003eREGION\u003c/var\u003e`-docker.pkg.dev/`\u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e`/gcf-artifacts`.\n\n 4. The image is deployed to Cloud Run as a service.\n\n 5. You can trigger or invoke the function with Eventarc,\n Pub/Sub, or other HTTP triggers.\n\nWhat's next\n-----------\n\n- Learn about the [different types of functions](/run/docs/write-functions) and your options for [triggering functions](/run/docs/function-triggers).\n- If you previously created functions with the Cloud Functions API, see the [Cloud Run functions comparison guide](/run/docs/functions/comparison) to learn about the differences between the two versions of Cloud Run functions."]]