Zadig 文档
Zadig
教程
博客
论坛
关于
中文英文
Zadig
教程
博客
论坛
关于
Zadig v4.2
Loading...
     编辑文档
     反馈问题
     社区讨论

    本页导航

    Custom Image

    This article explains how to use custom images as the base runtime environment for building, testing, and code scanning in the Zadig system. If the build, test, or code scanning process requires installing many tools and dependencies, you can package these tools and dependencies into a custom image in advance. Using this custom image during the build, test, or code scanning process can significantly improve task execution efficiency.

    # Step 1: Generate a Custom Image

    • Write a Dockerfile and add Docker instructions according to your actual needs.

    Warning

    When using a custom image, ensure that the dependencies required by the Zadig system are installed in the image; otherwise, it may not function properly.
    Required dependencies:

    1. curl: for retrieving network resources
    2. git: for executing git commands and fetching build code (please ensure version 2.11.0 or higher is installed)
    3. tzdata: for maintaining container time synchronization

    In addition to the above dependencies, the custom image used by the build module must also install:

    • docker cli: for executing Docker commands, it must be installed in the /usr/local/bin directory.

    In addition to the above dependencies, the custom image used by the code scanning module must also install:

    • Java(Oracle JRE or OpenJDK)
    • sonar-scanner

    You can refer to the following two examples of ubuntu:focal and centos:7.8.2003 to write your own Dockerfile:

    FROM ubuntu:focal
    
    # Add custom instructions here
    
    # The following are the dependencies required by Zadig
    
    # Install tools curl git tzdata
    RUN sed -i -E "s/[a-zA-Z0-9]+.ubuntu.com/mirrors.aliyun.com/g" /etc/apt/sources.list
    RUN apt-get clean && apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y curl git tzdata
    
    # Modify the time zone
    RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
    
    # Install docker client
    RUN curl -fsSL "http://resources.koderover.com/docker-27.4.1.tgz" -o docker.tgz &&\
        tar -xvzf docker.tgz &&\
        mv docker/* /usr/local/bin
    
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    FROM centos:7.8.2003
    
    # Add custom instructions here
    
    # The following are the dependencies required by Zadig
    
    # Install tools curl git tzdata
    RUN yum -y install curl git tzdata
    
    # Modify the time zone
    RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
    
    # Install docker client
    RUN curl -fsSL "http://resources.koderover.com/docker-27.4.1.tgz" -o docker.tgz &&\
        tar -xvzf docker.tgz &&\
        mv docker/* /usr/local/bin
    
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    • To build the image, you can refer to the following command:
    docker build -t name:tag -f Dockerfile .
    
    1
    • Push the image generated in the previous step to a public image repository or a private image repository that has been integrated into the Zadig system
    docker push name:tag
    
    1

    # Step 2: Create a Custom Image

    Click System Settings -> Custom Image -> Add as shown below:

    Add a custom image

    Parameter description:

    • Label: Please provide a name that can be used to identify the image
    • Image Name: Please fill in the image name that was uploaded to the image registry before. You need to fill in the complete image name, such as ccr.ccs.tencentyun.com/namespace/imageName:tag

    # Step 3: Use a Custom Image

    Custom images can be used in the build, test, and code scanning modules. The following example demonstrates using a custom image in the build module.

    Enter the project's build section -> Click Add, and you can select the custom image in the Operating System option. When executing the build task, your custom image will be used as the operating system

    Using a custom image

    ← PackagesShared Variables→

    资源
    教程
    论坛
    博客
    公司
    关于
    客户故事
    加入我们
    联系我们
    微信扫一扫
    hello@koderover.com

    © 2026 筑栈(上海)信息技术有限公司 沪 ICP 备 19000177 号 - 1

    •  跟随系统
    •  浅色模式
    •  深色模式
    •  阅读模式