An image build provides the capability to compile the source code of an application into an image. After an image is built, the image is pushed to the default image center of LDC Hybrid Cloud (LHC) by default.
Create a build
This section describes how to create an image build in the LHC console.
Prerequisites
You have created an application. For more information, see Create an application.
Procedure
Log on to the console and choose Image Center > Build Image in the left-side navigation pane.
On the build list page, click Create.
On the Create Image Build page, specify the following configuration information, and then click Submit on the Confirm Configuration page to complete the build.
Basic Configuration
Application: Select the application with which the build is to be associated.
Build Set Name: Optional.
Warehouse Namespace: Select a namespace created in Alibaba Cloud Container Registry (ACR).
Image Name: By default, the image name is the same as the application name and cannot be modified.
Code Repository Type: This parameter is required. External GitLabs are supported. You can configure a GitLab of release 8.8 or later that supports access from the Internet. APIs of GitLab v3 and v4 are also supported. You also need to specify External GitLab Address and External GitLab Token.
(Optional) Advanced Settings
Source Image Center Access Configuration: specifies the information for accessing the image center in which the FROM image in Dockerfile is located. You can add multiple configurations.
Upload to Custom Image Center: specifies the access information of the additional image center to which the image will be uploaded after it is built. If this option is not enabled, images are pushed only to the default image center of the SOFAStack platform. If you enable this option, you must specify the following configuration items:
Custom Image Name: Enter a string in the
registry URL/namespace/repositoryformat, for example,registry.cn-hangzhou.antcloud.com/mytenant/sayhello.Username: Optional. This parameter is required when the username and password are required for logging on to the configured image center.
Password: Optional. This parameter is required when the username and password are required for logging on to the configured image center.
Build Path: Optional. This parameter specifies the working directory for executing the
docker buildcommand. This directory is the relative path of the source code after it is checked out. By default, the value is the root directory of the source code.Dockerfile Path: Optional. This parameter specifies the
--fileparameter for executing thedocker buildcommand. By default, the value is the Dockerfile file in the root directory of the source code.
Trigger a build
You can trigger an image build after the local code is updated.
Procedure
Log on to the console and choose Image Center > Build Image in the left-side navigation pane to go to the build list page.
Click the name of a build to go to the details page of the build.
On the Build History tab, click Trigger Build.
In the Build dialog box, specify the following parameters, and then click OK.
Branch: the branch of the code, for example,
masterordev.Build Parameter: the
--build-argparameter for executing thedocker buildcommand.
Delete a build
You can delete builds that are no longer in need from the console.
Procedure
Log on to the console and choose Image Center > Build Image in the left-side navigation pane to go to the build list page.
Click Delete in the Actions column of the target build. In the Delete Build dialog box, click OK.
You can select Also Delete Image to delete the image associated with the build.
View build history
After an image build is complete, you can go to the details page of the build to view build details.
Procedure
Log on to the console and choose Image Center > Build Image in the left-side navigation pane to go to the build list page.
Click the name of a build to go to the details page of the build.
On the Build History tab, view the build history information. You can click the Copy icon to the right of the image version to copy the image address, or click the sequence number of an image build record to view detailed build logs. For more information, see the View trigger logs section.
View trigger logs
You can view the complete trigger logs of a build in the console.
Procedure
Log on to the console and choose Image Center > Build Image in the left-side navigation pane to go to the build list page.
Click the name of a build to go to the details page of the build.
On the Build History tab, click the sequence number of an image build record to view detailed trigger logs.
