Tetap teratur dengan koleksi
Simpan dan kategorikan konten berdasarkan preferensi Anda.
Buildpack menggunakan
builder default,
yang terdiri dari semua komponen yang diperlukan untuk menjalankan build
layanan Anda, termasuk image build dan run:
Image build: Digunakan oleh image builder untuk membuat lingkungan build
tempat buildpack
siklus proses
dieksekusi. Di sinilah aplikasi atau fungsi Anda disiapkan untuk containerization.
Image run: Image dasar tempat image container layanan Anda
dibuat. Ini adalah image yang menghosting aplikasi atau fungsi yang Anda buat.
Kedua image dapat disesuaikan dan diperluas agar sesuai dengan kebutuhan Anda. Misalnya, Anda dapat menyesuaikan image untuk menambahkan paket yang diperlukan untuk membuat layanan, atau menginstal paket sistem agar tersedia saat layanan Anda berjalan.
Sebelum memulai
Anda menggunakan CLI pack untuk membuat layanan secara lokal menjadi image container.
Instal alat Kontrol sumber Git
untuk mengambil aplikasi contoh dari GitHub.
Menyesuaikan image build dan run
Buildpack menggunakan image builder untuk menyusun layanan Anda menjadi
image container. Setelah proses build selesai, aplikasi atau
fungsi Anda akan dimasukkan ke dalam image run. Pelajari proses build lebih lanjut
di Konsep Buildpack.
Memperluas image builder
Untuk menyesuaikan image builder default:
Buat builder.Dockerfile kustom dari image builder default. Anda
harus menentukan tag untuk
versi builder yang mendukung image
dasar Anda. Misalnya, tag image dasar :v1 tidak didukung oleh tag builder :google-22.
SERVICE_IMAGE_NAME dengan nama yang Anda pilih untuk image aplikasi atau fungsi.
BUILDER_IMAGE_NAME dengan nama image builder kustom Anda.
Memperluas image run
Untuk menyesuaikan image container yang dijalankan secara default:
Buat run.Dockerfile kustom dari image run default. Anda
harus menentukan tag untuk
versi builder yang mendukung image
run Anda. Misalnya, tag image run :v1 tidak didukung oleh
tag builder :google-22.
[[["Mudah dipahami","easyToUnderstand","thumb-up"],["Memecahkan masalah saya","solvedMyProblem","thumb-up"],["Lainnya","otherUp","thumb-up"]],[["Sulit dipahami","hardToUnderstand","thumb-down"],["Informasi atau kode contoh salah","incorrectInformationOrSampleCode","thumb-down"],["Informasi/contoh yang saya butuhkan tidak ada","missingTheInformationSamplesINeed","thumb-down"],["Masalah terjemahan","translationIssue","thumb-down"],["Lainnya","otherDown","thumb-down"]],["Terakhir diperbarui pada 2025-08-18 UTC."],[[["\u003cp\u003eBuildpacks utilize a builder image, consisting of both a build image for creating the build environment and a run image that hosts the built application or function.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003epack\u003c/code\u003e CLI tool is used to build a service into a container image locally, requiring Docker, Pack CLI, and Git to be installed beforehand.\u003c/p\u003e\n"],["\u003cp\u003eBuilder images can be customized by creating a \u003ccode\u003ebuilder.Dockerfile\u003c/code\u003e and using \u003ccode\u003edocker build\u003c/code\u003e to add necessary packages or components to the building process, and then can be used via \u003ccode\u003epack build\u003c/code\u003e to build a service.\u003c/p\u003e\n"],["\u003cp\u003eRun images can also be customized by creating a \u003ccode\u003erun.Dockerfile\u003c/code\u003e, using \u003ccode\u003edocker build\u003c/code\u003e to add necessary system packages or components, and then using \u003ccode\u003epack build\u003c/code\u003e with the \u003ccode\u003e--run-image\u003c/code\u003e flag to build a service using the customized image.\u003c/p\u003e\n"]]],[],null,["# Configure your build and run images\n\nBuildpacks uses a default\n[builder](https://buildpacks.io/docs/for-platform-operators/concepts/builder/),\nwhich consists of all the components necessary to execute a build of your\nservice including both a *build* and *run* image:\n\n- **Build image** : Used by the builder image to create the build environment where the buildpacks [lifecycle](https://buildpacks.io/docs/for-platform-operators/concepts/lifecycle/) is executed. This is where your application or function is prepared for containerization.\n- **Run image**: The base image from which the container image of your service is built. This is the image that hosts your built application or function.\n\nBoth images can be customized and extended to suit your needs. For example, you\ncan customize images to add the packages that are required for building your\nservice, or to install system packages so they are available when your\nservice runs.\n\nBefore you begin\n----------------\n\nYou use the `pack` CLI to locally build your service into a container image.\n\n### Before you begin\n\n1. Install [Docker Community Edition (CE)](https://docs.docker.com/engine/installation/) on your workstation. Docker is used by `pack` as an OCI image builder.\n2. Install [Pack CLI](https://buildpacks.io/docs/tools/pack/).\n3. Install the [Git source control](https://git-scm.com/downloads) tool to fetch the sample application from GitHub.\n\nCustomize the build and run images\n----------------------------------\n\nBuildpacks use a builder image to construct your service into a\ncontainer image. When the build process is complete, your application or\nfunction is inserted into a run image. Learn more about the build process\nat [Buildpacks Concepts](https://buildpacks.io/docs/for-platform-operators/concepts/).\n\n### Extending the builder image\n\nTo customize the default builder image:\n\n1. Create a custom `builder.Dockerfile` from the default builder image. You\n must specify the tag for the\n [version of the builder](/docs/buildpacks/builders) that supports your base\n image. For example, the `:v1` base image tag is unsupported by the\n `:google-22` builder tag.\n\n Example: \n\n FROM gcr.io/buildpacks/builder\n USER root\n RUN apt-get update && apt-get install -y --no-install-recommends \\\n subversion && \\\n apt-get clean && \\\n rm -rf /var/lib/apt/lists/*\n USER cnb\n\n2. Build your custom builder image from the `builder.Dockerfile` file:\n\n docker build -t \u003cvar translate=\"no\"\u003eBUILDER_IMAGE_NAME\u003c/var\u003e -f builder.Dockerfile .\n\n Replace `BUILDER_IMAGE_NAME` with the name that you choose for your custom\n builder image.\n3. Run the [`pack build`\n command](https://buildpacks.io/docs/tools/pack/cli/pack_build/)\n with your custom builder image to build the new container image of your\n application or function:\n\n pack build \u003cvar translate=\"no\"\u003eSERVICE_IMAGE_NAME\u003c/var\u003e --builder \u003cvar translate=\"no\"\u003eBUILDER_IMAGE_NAME\u003c/var\u003e\n\n Replace:\n - `SERVICE_IMAGE_NAME` with the name that you choose for your application or function image.\n - `BUILDER_IMAGE_NAME` with the name of your custom builder image.\n\n### Extending the run image\n\nTo customize the default run container image:\n\n1. Create a custom `run.Dockerfile` from the default run image. You\n must specify the tag for the\n [version of the builder](/docs/buildpacks/builders) that supports your run\n image. For example, the `:v1` run image tag is unsupported by the\n `:google-22` builder tag.\n\n Example: \n\n FROM gcr.io/buildpacks/gcp/run\n USER root\n RUN apt-get update && apt-get install -y --no-install-recommends \\\n imagemagick && \\\n apt-get clean && \\\n rm -rf /var/lib/apt/lists/*\n USER 33:33\n\n2. Build your custom run image from the `run.Dockerfile` file:\n\n docker build -t \u003cvar translate=\"no\"\u003eRUN_IMAGE_NAME\u003c/var\u003e -f run.Dockerfile .\n\n Replace `RUN_IMAGE_NAME` with the name that you choose for your custom run\n image.\n3. Run the [`pack build`\n command](https://buildpacks.io/docs/tools/pack/cli/pack_build/)\n with your custom run image to build the new container image of your\n application or function:\n\n pack build \u003cvar translate=\"no\"\u003eSERVICE_IMAGE_NAME\u003c/var\u003e --builder gcr.io/buildpacks/builder:v1 --run-image \u003cvar translate=\"no\"\u003eRUN_IMAGE\u003c/var\u003e\n\n Replace:\n - `SERVICE_IMAGE_NAME` with the name that you choose for your application or function image.\n - `RUN_IMAGE_NAME` with the name of your custom run image."]]