Updated on 2024-04-18 GMT+08:00

Building Images and Pushing to SWR

CodeArts Build provides a large number of default build actions and templates. If necessary dependency packages and tools are missing, you can create an image from a Dockerfile and push it to the specified repository in SWR.

This document uses Maven build as an example.

Prerequisites

Configuration Description

Add Build Image and Push to SWR after Build with Maven, when configuring build actions.

In the Build with Maven action, retain default values of the parameters. In the Build Image and Push to SWR action, set the parameters as described in the following table.

Parameter

Description

Action Name

Name of a build action. It can be customized.

Tool Version

Select the tool version. You can also use the default version.

Image Repository

By default, CodeArts Build provides the SWR repository address of each region. You do not need to change the address.

NOTE:

Images can be pushed to custom image repositories.

Authorized User

Current user. Ensure that you have the permissions to edit or manage all images in the organization. For details, see User Permissions.

Organization

Select the organization created in Prerequisites from the drop-down list.

Image Name

Name of the created image, which can be customized.

Image Tag

Specify the image tag, which can be customized. You can use Image name:Tag to uniquely specify an image.

Working Directory

The context path parameter in the docker build command is the relative path of the root directory of the CodeArts Repo code repository.

Context path: When Docker builds an image, the docker build command packs all content in the path and sends it to the container engine to help build the image.

Dockerfile Path

Path of the Dockerfile. Set this parameter to a path relative to the working directory. For example, if the working directory is a root directory and the Dockerfile is in the root directory, set this parameter to ./Dockerfile.

Add Build Metadata to Image

Add the build information to the image. After the image is created, run the docker inspect command to view the image metadata.