Baidu AI Cloud
中国站

百度智能云

Cloud Container Engine

Build Services by Container Image

Sketch

Cloud platform image building service supports the configuration of image building rules based on code repository or dockerfile on the page, and the image building is triggered manually by users automatically by code repository changes, to open the intermediate link between user code changes and container deployment, so as to facilitate users to deploy container services more efficiently and conveniently. Note: A series of commands and parameters required for building a docker image can be recorded in dockerfile. For the format and writing method of dockerfile, please see Docker Official Document.

Special Feature

  • Automatically trigger build when code changes It can be turned on in the build configuration. After it is turned on, the image build can be triggered automatically when the code is submitted/tag is added.
  • Support overseas construction In the process of code construction, it may rely on foreign countries, and the image building service provides overseas construction function by default.
  • Support multi-stage construction The multi-stage build feature introduced in the new version of Docker is supported.

Building Image Based on Githud Code Repository

1.Add Githud account authorization. On the image repository-my image page, click the source code authorization management in the upper left corner to add Githud authorization. After the Githud account authorization is completed according to the web page prompt, the code repository under the Githud account can be used as the image building source.

2.Add the construction configuration based on Githud code repository. Select an existing image or create a new image as the target image to be pushed after construction. Click the image name and select the image building tab on the left to create a new image building configuration.

Click new build configuration and select to build from Githud source code.

  • Build configuration name: Specify a configuration name for this build configuration.
  • Githud account: You can select a Githud account that the user has authorized.
  • Repository: You can select a code repository under Githud account as the construction source.
  • Branch: Select the code branch to build.
  • Dockerfile path: The path of the dockerfile relative to the code repository root. For example, if the Dockerfile is located in the code root directory and the filename is Dockerfile.build, fill in /Dockerfile.build.
  • Turn on auto build: Automatically trigger image building by code base change or not.
  • Trigger condition: You can choose the conditions that automatically trigger the image building.

    • Add a new tag When a new tag is added to the code repository, automatically trigger the image building with the commit of the tag.
    • When committing code to a branch When the code of the branch selected by the user changes, the latest commit of the branch will trigger the image building automatically.
  • Version: For the image version rules generated by image building, you can choose to build the corresponding branchtag name, image building time, and build the corresponding submission hash as part of the version. You can specify multiple target versions, and you can fill in up to 5 versions for each mirror construction rule.

    3.After the configuration is completed, the user can manually trigger the image building, or the code base changes can automatically trigger the image building (the user needs to open the automatic construction and configure the automatic construction rules). The construction records can be viewed in the construction log, and the specific construction output can be viewed through the log details.

    4.If the image is successfully built and pushed through the build configuration, the Create method column in the image version list will show that the image build source is auto built/manual built, and it can correspond to the image build configuration used by the building, which is different from the user's direct push image (user push).

Construct Image Based on Dockerfile

The users can directly upload or write Dockerfile in the page, and construct an image based on the Dockerfile.

1.In the page of Image Library-My Image, select an existing image or create one image as the target image to be pushed after construction. Click the image name and select the image building tab on the left to create a new image building configuration.

Click "Create Construction Configuration", and select "Create by Dockerfile".

  • Build configuration name: Specify a configuration name for this build configuration
  • Configuration of Dockerfile: Directly select to write/upload the Dockerfile file in the page/locally. If you select to upload the Dockerfile file locally, the uploaded file contents are displayed in the textbox below, and the users can further edit the contents.
  • Version: For the rules of image version names generated by the image construction, we can use the image construction time as part of the version name. You can specify multiple target versions, and you can fill in up to 5 versions for each mirror construction rule.

    2.After configuration, the users can manually trigger the image construction. Users can view the construction record in the construction log, as well as the specific construction output by the log details.

    3.If an image is constructed and pushed by the construction configuration, the creation mode column in the image version list shows the image construction source of manual construction, and can correspond to the image construction configuration used by construction, distinguishing itself from the method of pushing an image directly by the users (user push).

Previous
Basic Operation of Image Repository
Next
Virtual Node