Image build

更新时间:
复制 MD 格式

An image build compiles the source code of an application into an image. When you create a build, the system automatically creates an image repository in the ACR Image Center. The repository name is the same as the application name. After a successful build, the image is automatically pushed to this repository.

Create a build

This section describes how to build an image in the containerized application service console.

Prerequisites

  • An application has been created.

  • You have the AKS developer role.

  • You have created a namespace in Container Registry (ACR).

Procedure

  1. Log on to the containerized application service console. In the navigation pane on the left, click Image Center > Image Build.

  2. On the build list page, click Create Image Build.

  3. On the Create Image Build page, set the following parameters and click Submit to create the application build.

Build configuration

Basic configuration

  • Application: Select the application to associate with the build.

  • Build Set Name: Optional.

  • Repository Namespace: Select the namespace that you created in ACR.

  • Image Name: The image name is the same as the application name by default and cannot be changed.

  • Code Repository Type: A code repository must be configured to create a build. Currently, only External GitLab is supported. You must use a GitLab repository that is accessible over the public network and runs version 8.8 or later. Both GitLab v3 and v4 APIs are supported. In addition to the External GitLab Address, you must also configure an External GitLab Token.

Advanced configuration (Optional)

  • Source Image Center Access Configuration: The access configuration for the image center where the FROM image in the Dockerfile is located. You can configure multiple access configurations.

  • Upload to Custom Image Center: This option is disabled by default. It lets you configure access information for an additional image center to push the image to after a successful build. If you do not configure this, the image is pushed only to the default image center on the SOFAStack platform. If you enable this option, set the following parameters:

    • Custom Image Name: Enter a string that contains registryurl/namespace/repository, such as registry.cn-hangzhou.antcloud.com/mytenant/sayhello.

    • Username: Optional. The username required to log on to the specified image center.

    • Password: Optional. The password required to log on to the specified image center.

  • Build Path: Optional. The working directory where the docker build command is executed. This path is relative to the source code after checkout. The default is the root directory of the source code.

  • Dockerfile Path: Optional. The value for the --file parameter for the docker build command. The default is the Dockerfile in the root directory of the source code.

Trigger a build

You can trigger an image build after you update the code locally.

Procedure

  1. Log on to the containerized application service console. In the navigation pane on the left, click Image Center > Image Build to go to the build list page.

  2. Click a Build Set Name to go to the build details page.

  3. On the Build History tab, click Trigger Build.

  4. In the Trigger Build dialog box that appears, enter the following parameters and click OK.

    • Build Branch/Tag: The branch of the code, such as master or dev.

    • Custom Build Parameters: Enter custom key-value pairs to use as the --build-arg parameter for the docker build command.

Delete a build

You can delete builds that you no longer need from the console.

Procedure

  1. Log on to the containerized application service console. In the navigation pane on the left, click Image Center > Image Build to go to the build list page.

  2. In the Actions column of the build, click Delete. In the Delete Build dialog box that appears, click OK.

View build history

After an image build is complete, you can go to the build details page to view the build details.

Procedure

  1. Log on to the containerized application service console. In the navigation pane on the left, click Image Center > Image Build to go to the build list page.

  2. Click a Build Set Name to go to the build set details page.

  3. On the build set details page, you can view the basic information and build history of the image build.

    You can click the copy button 1 next to Image Version to copy the image version.

View the trigger log

You can view the complete build trigger log in the console.

Procedure

  1. Log on to the containerized application service console. In the navigation pane on the left, click Image Center > Image Build to go to the build list page.

  2. Click a Build Set Name to go to the build details page.

  3. On the Build History tab, click the ID of the image build to view detailed trigger log information.