Creating 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
- You have created an organization in SWR. For details about organization restrictions, see Notes and Constraints.
- You have created a code repository by using system template Java Maven Demo. For details, see Creating a Repository Using a Template.
- You have customized a build environment and upload the Dockerfile and other files required for image creation to the root directory of the code repository.
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 |
Enter the organization name of the SWR repository created in Prerequisites. |
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. |
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.