A container technology-based CI / CD service deployment method, device, equipment and medium

By using a container image library and deployment executor program based on the OCI standard, containerized deployment on traditional servers has been achieved, solving the problem of the difficulty in containerizing traditional servers and improving deployment stability and efficiency.

CN114035890BActive Publication Date: 2025-11-28GUANGZHOU SANQI NETWORK TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111238200.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-10-22
Publication Date
2025-11-28
Estimated Expiration
2041-10-22

AI Technical Summary

Technical Problem

Traditional application deployment methods are difficult to containerize on traditional servers, making them difficult to implement.

Method used

It adopts a container image library and deployment executor program based on the OCI standard, and realizes CI/CD service deployment through remote transmission of container images, ensuring that the build environment is independent and does not require changes to the traditional container cluster architecture.

Benefits of technology

It achieves compatibility between traditional server and container deployment modes, improving the stability and efficiency of application deployment.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114035890B_ABST
    Figure CN114035890B_ABST
Patent Text Reader

Abstract

The application discloses a CI / CD service deployment method, device and equipment based on a container technology and a medium, and the method comprises the following steps: in response to a received release instruction, a target container image is acquired from a container image library; the target container image is stored in the container image library based on an OCI standard and contains a target program file to be deployed; the target container image is run to create a deployment execution container, and the target program file is remotely transmitted to a target server. The above method uploads and stores the target container image based on the OCI standard, and releases the target program file in the target container image to the target server through a built release channel, so that the independence of the built environment is ensured, and the release architecture of the traditional container cluster does not need to be changed.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of computer, in particular to a CI / CD service deployment method and device based on container technology, equipment and medium. BACKGROUND

[0002] In the traditional application deployment mode, a Linux virtual machine server is usually used as a release machine to build programs, and the built program files are stored in the release machine, a mounted disk, an OSS, etc. When it is necessary to release, the resources are downloaded and released through rsync and ssh.

[0003] In recent years, with the development of cloud computing and cloud services, container technology has been widely applied. At present, the new application deployment mode is mainly realized by deploying containers. However, this mode needs to deploy a container cluster or other container orchestration schemes, and cannot be directly integrated with traditional non-containerized system architecture, which makes it difficult to be applied to traditional server deployment. SUMMARY

[0004] In order to solve the above technical problems, the present application provides a CI / CD service deployment method and device based on container technology, equipment and medium. Specifically, the following technical solutions are realized:

[0005] In the first aspect, the present application provides a CI / CD service deployment method based on container technology, comprising:

[0006] In response to the received release instruction, a target container image is obtained from a container image library; the target container image is stored in the container image library based on the OCI standard, and contains a target program file to be deployed;

[0007] The target container image is run to create a deployment execution container, and the target program file is remotely transmitted to a target server.

[0008] In a possible implementation, the target program file is remotely transmitted to the target server, specifically:

[0009] The target program file is sent to the target server through a release channel based on a remote transmission protocol by using a release program in the target container image; the release channel refers to a transmission channel corresponding to each target server.

[0010] In a possible implementation, the construction method of the release channel is specifically:

[0011] The target file name of the target program file is extracted by a preset file extraction program of Dockerfile;

[0012] send the target file name to the target server to build a publishing channel corresponding to the target server.

[0013] In a possible implementation, the target container image is built by the following steps:

[0014] In response to the received build instruction, a Dockerfile file is run to build a target container image corresponding to the target program file.

[0015] In a second aspect, the present application provides a CI / CD service deployment device based on container technology, comprising:

[0016] a building unit and a publishing unit; wherein,

[0017] The building unit is configured to build a target container image corresponding to the target program file according to the received build instruction, and store the target container image in a container image library based on the OCI standard;

[0018] The publishing unit is configured to obtain the target container image from the container image library in response to the received publishing instruction; run the target container image to create a deployment execution container, and remotely transmit the target program file to a target server.

[0019] In a possible implementation, the remotely transmitting the target program file to the target server specifically comprises:

[0020] Using a publishing program in the target container image, the target program file is sent to the target server through a publishing channel based on a remote transmission protocol; the publishing channel refers to a transmission channel corresponding to each target server.

[0021] In a possible implementation, the building manner of the publishing channel specifically comprises:

[0022] The Dockerfile extracts a target file name of the target program file through a preset file extraction program;

[0023] The target file name is sent to the target server to build a publishing channel corresponding to the target server.

[0024] In a possible implementation, the target container image is built by the following steps:

[0025] In response to the received build instruction, a Dockerfile file is run to build a target container image corresponding to the target program file.

[0026] In a third aspect, the present application provides a data processing device, comprising a processor, wherein the processor is coupled with a memory, and the memory stores a program, and the program is executed by the processor, so that the data processing device executes the container technology-based CI / CD service deployment method in the first aspect.

[0027] In a fourth aspect, the present application further provides a computer readable storage medium, which stores a computer program, and the computer program is executed by a processor, so as to realize the container technology-based CI / CD service deployment method in the first aspect.

[0028] Compared with the prior art, the present application has the beneficial effects that:

[0029] The container technology-based CI / CD service deployment method provided by the present application uploads and stores the container image based on the OCI standard, creates a deployment execution container by running the target container image, remotely transmits the deployment target stored in the container to the specified deployment target server, and completes the application deployment. This method not only ensures the independence of the build environment, but also does not need to change the release architecture of the traditional container cluster, and effectively realizes the compatibility of the traditional server deployment and the container deployment mode. BRIEF DESCRIPTION OF DRAWINGS

[0030] In order to more clearly illustrate the technical solutions of the present application, the drawings needed in the embodiments will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor.

[0031] Figure 1 is a flowchart of the container technology-based CI / CD service deployment method provided by the embodiment of the present application;

[0032] Figure 2 is a structural block diagram of the container technology-based CI / CD service deployment device provided by the embodiment of the present application. DETAILED DESCRIPTION

[0033] The technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only some embodiments of the present application, not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative labor are within the scope of protection of the present application.

[0034] Some concepts related to the present application are explained below:

[0035] A container (Docker) is an engine for implementing container image construction, distribution and running. Based on Docker, developers and administrators can use containers to develop, deploy and run applications. Docker generally includes a Docker client and a Docker engine, which is a daemon process running on the host to manage images and containers.

[0036] A container image is an executable package that contains everything needed to run an application, such as the application's code, libraries, environment variables and configuration files. The container image can run in any environment with a Docker engine. When the container image runs, it is created as a Docker container.

[0037] Specifically, the contents of the container image usually include a metadata file, a configuration file and at least one image layer file. The metadata file can be a manifest.json file that records the metadata of all image layer files. The configuration file is used to record the memory size occupied by the image, the instruction type contained in the image, etc. The image layer file can be a layer file.

[0038] A Docker container is an instance of a running container image. Docker containers can be used to isolate software and hardware outside the container.

[0039] For the deployment process of a traditional server, the source files of the build product are usually obtained from a CI / CD system, and then copied to the deployment target server through a remote transmission protocol. After the transmission is completed, a specified shell script may need to be executed to perform application restart and configuration loading operations. The complete process often involves batch operations of multiple servers. The present application provides a new CI / CD service deployment method based on container deployment mode.

[0040] Referring to Figure 1 , the CI / CD service deployment method provided by the embodiment of the present application based on container technology specifically includes the following steps:

[0041] S1: In response to the received release instruction, a target container image is obtained from a container image library; the target container image is stored in the container image library based on the OCI standard and contains a target program file to be deployed.

[0042] CI / CD, also known as Continuous Integration / Delivery, is a method of realizing frequent delivery of applications by introducing automation in the application development stage, where CI represents Continuous Integration, and CD represents Continuous Delivery and Continuous Deployment.

[0043] The container image library is a repository that provides functions of uploading, downloading and managing container images, and stores a large number of container images. The container image library can be implemented based on the container registry protocol.

[0044] In order to realize compatibility between traditional server deployment and container construction technology, the embodiment of the application adds a deployment layer in the construction process of the container image, and specifically relates to three key parameters and a deployer program. First, the deployment layer file source stage specifies which layer of files will be deployed as the construction product files in the container image construction process. Second, the deployment target file list specifies which part of the files from the deployment layer file source stage will be deployed as the construction product files in the original container image construction process. Third, the deployment layer base image specifies which base images the deployment target file list from the deployment layer file source stage will be stored in.

[0045] The deployer program is stored in the base image of the deployment layer in advance, or can be injected into the deployment execution container through file mounting when the deployment image is running. After receiving the deployment parameters from the CI / CD, the deployer program creates a deployment execution container by running the container image, and remotely transmits the deployment target stored in the same container to the specified deployment target server.

[0046] In the embodiment, the target program file is constructed through the container image to ensure the absolute independence and isolation of the construction environment. Specifically, the construction process of the container image is as follows:

[0047] When receiving the construction instruction, the Dockerfile file is run to construct the target container image corresponding to the target program file by reading and executing the docker build instruction in the Dockerfile.

[0048] After completing the construction of the target container image, in the embodiment, when receiving the image sending instruction, the constructed target container image is uploaded to the container image library based on the OCI standard, where the image sending instruction can be a dockerpush instruction.

[0049] After receiving the target container image, the container image library stores the target container image and the image identifier of the target container image.

[0050] Specifically, the docker build command is used to create a container image using a Dockerfile. Specifically, the -f flag can be used in the docker build command to point to the Dockerfile at any location in the file system. The Dockerfile is composed of several lines of command statements, which usually include base image information, image operation instructions, and container startup execution instructions.

[0051] The OCI (Open Container Initiative) standard, also known as the Open Container Project, is a collaborative project under the Linux Foundation. It formulates an open industry standard for operating system virtualization (especially Linux containers) in an open governance manner. Currently, OCI has formulated a container runtime specification and a container image specification, and the two specifications are associated with each other. The container image specification defines the composition of the image, including the file format and content, the manifest, the image index (optional), the layering of the file system, and the configuration file. The runtime specification creates a container to run a program according to the configuration. It can be understood that the image specification helps to create interoperable tools, and the runtime specification specifies the configuration, execution environment, and life cycle of the container.

[0052] The above embodiment unifies the standardized container image format using the OCI standard to obtain a stable declarative dependency environment. In the process of uploading, downloading, and storing program files according to the OCI standard, the standard image can be built, transferred, and prepared for running in each container without customizing the protocol, thereby simplifying the file data transmission and storage process and improving the running efficiency.

[0053] In another embodiment, for each image layer in the target container image, it can be queried whether the image layer has been stored in the container image library. If not, the image layer is sent to the container image library. If it has been stored, it is continued to be queried whether the next image layer of the image layer has been stored in the container image library. Through the above-mentioned query and uploading of the image layer, the metadata file of the target container image is uploaded after confirming that all image layers in the target container image have been uploaded, thereby completing the uploading and storage process of the target container image.

[0054] S2: running the target container image to create a deployment execution container, and remotely transmitting the target program file to the target server.

[0055] It can be understood that in the service deployment process, a deployment execution container is usually created and run based on a project container image, wherein the project container image is built based on an application and its dependent packages, with a start command of the application, and when the deployment execution container is started and run, the command is executed, so that the application will be started when the deployment execution container is started.

[0056] In the embodiment, the deployment execution container corresponding to the target container image can be started and run by using a Docker run instruction, and then the publishing program in the target container image is used to send the target program file to the target server through a preset publishing channel based on a remote transmission protocol.

[0057] The remote transmission protocol can be rsync, which is a data image backup tool under a Linux system and can safely and quickly realize remote file transmission.

[0058] The publishing channel refers to a transmission channel corresponding to each target server. In the embodiment, the construction manner of the publishing channel is specifically the following steps:

[0059] Step 1: The Docker file extracts the target file name of the target program file by using a preset file extraction program.

[0060] Step 2: The target file name is sent to the target server to construct the publishing channel corresponding to the target server.

[0061] It can be understood that for each independent deployment target server, the program file can be transmitted by using a pre-constructed publishing channel transmission program to accurately send the program file to the corresponding target server, so as to improve the stability of task publishing.

[0062] The above embodiment of the application customizes a service deployment layer on the basis of the OCI standard to serve as a transfer process of traditional server storage and program file publishing; in the application deployment process, the target container image is obtained in the service deployment layer, and the target program file in the target container image is sent to the target server by using a pre-set publishing channel, so that each publishing process is effectively isolated, and tasks are more stably published under the traditional container cluster publishing architecture.

[0063] Please refer to Figure 2 , in a second aspect, the application provides a CI / CD service deployment device based on a container technology, specifically comprising a construction unit 101 and a publishing unit 102, wherein:

[0064] The construction unit 101 is configured to construct a target container image corresponding to the target program file according to the received construction instruction, and store the target container image in a container image library based on an OCI standard.

[0065] The publishing unit 102 is configured to acquire the target container image from the container image library in response to the received publishing instruction, run the target container image to create a deployment execution container, and remotely transmit the target program file to a target server.

[0066] CI / CD, also known as Continuous Integration / Delivery, is a method of realizing frequent delivery of an application by introducing automation in the application development stage, where CI represents Continuous Integration, and CD represents Continuous Delivery and Continuous Deployment.

[0067] The container image library is a warehouse providing uploading, downloading and management functions of container images, and stores a large number of container images. The container image library can be realized based on a container registry protocol.

[0068] In order to realize compatibility of traditional server deployment and container construction technology, the embodiment of the application adds a deployment layer in the construction process of the container image, and specifically relates to three key parameters and a deployer program. One is a deployment layer file source stage, which specifies which layer of file will be deployed as a construction product file in the container image construction process. Two is a deployment target file list, which specifies which part of the file from the deployment layer file source stage will be deployed as a construction product file in the original container image construction process. Three is a deployment layer base image, which specifies that the deployment target file list from the deployment layer file source stage will be stored in which base image.

[0069] The deployer program is stored in the base image of the deployment layer in advance, or can be injected into the deployment execution container through file mounting when the deployment image is running. After receiving the deployment parameters from the CI / CD, the deployer program creates a deployment execution container by running the container image, and remotely transmits the deployment target stored in the same container to the specified deployment target server.

[0070] It can be understood that in the construction unit 101, the target program file is constructed through the container image to ensure the absolute independence and isolation of the construction environment. Specifically, the construction process of the container image is as follows:

[0071] When the build instruction is received, the Dockerfile file is run to build the target container image corresponding to the target program file by reading and executing the docker build instruction in the Dockerfile.

[0072] After the target container image is built, in the embodiment, when the image sending instruction is received, the built target container image is uploaded to the container image library based on the OCI standard, where the image sending instruction can be specifically a dockerpush instruction.

[0073] After the container image library receives the target container image, the target container image and the image identifier of the target container image are stored.

[0074] Specifically, the docker build command is used to create a container image using a Dockerfile, and specifically, the Dockerfile in any position of a file system can be pointed to by using the-f flag in the docker build command. The Dockerfile is composed of a plurality of command statements, and generally includes base image information, image operation instructions and container startup execution instructions.

[0075] The OCI (Open Container Initiative) standard, also known as the Open Container Project, is a cooperation project under the Linux Foundation, which formulates an open industrial standard for operating system virtualization (especially Linux containers) in an open governance manner. At present, the OCI has formulated a container runtime specification and a container image specification, and the two specifications are associated with each other. The container image specification defines the composition of the image, including the file format and content, the manifest, the image index (optional), the layering of the file system and the configuration file; and the runtime specification creates a container to run a program according to the configuration. It can be understood that the image specification helps to create interoperable tools, and the runtime specification specifies the configuration, execution environment and life cycle of the container.

[0076] The above embodiment unifies the standardized container image format by using the OCI standard to obtain a stable declarative dependent environment. In the process of uploading, downloading and storing the program file according to the OCI standard, the standard image can be built, transmitted and prepared for running the container image in each container without the need of customizing a protocol, thereby simplifying the transmission and storage process of the file data and improving the running efficiency.

[0077] In another embodiment, the building unit 101 can query whether each image layer in the target container image has been stored in the container image library, and if not, send the image layer to the container image library. If the image layer has been stored, the next image layer is queried, and the above steps are repeated until all image layers in the target container image are uploaded. Then, the metadata file of the target container image is uploaded to complete the uploading and storing process of the target container image.

[0078] In one embodiment, the publishing unit 102 is used for service deployment process, in which a deployment execution container is created and run based on the project container image. The project container image is built based on the application and its dependent packages, and has a startup command of the application. When the deployment execution container is started, the command is executed, so the application will be started when the deployment execution container is started.

[0079] In this embodiment, the deployment execution container corresponding to the target container image can be started by the Docker run instruction, and the publishing program in the target container image is used to send the target program file to the target server through the preset publishing channel based on the remote transmission protocol.

[0080] The remote transmission protocol can be rsync, which is a data image backup tool under the Linux system and can safely and quickly realize remote file transmission.

[0081] The publishing channel refers to the transmission channel corresponding to each target server. In this embodiment, the building method of the publishing channel includes the following steps:

[0082] Step one: the Docker file extracts the target file name of the target program file by the preset file extraction program.

[0083] Step two: send the target file name to the target server to build the publishing channel corresponding to the target server.

[0084] It can be understood that for each independent deployment target server, the program file can be transmitted to the corresponding target server by using the pre-built publishing channel transmission program to improve the stability of task publishing.

[0085] The above embodiment of the application customizes a service deployment layer on the basis of the OCI standard to serve as a relay process for traditional server storage and program file publishing; in the application program deployment process, the target container image is obtained in the service deployment layer, and the target program file in the target container image is sent to the target server by using the pre-set publishing channel, so that each publishing process is effectively isolated, and the task is more stably published under the traditional container cluster publishing architecture.

[0086] It should be noted that more information interaction and execution process between units in the above device are based on the same concept as the method embodiment of the first aspect of the application, and the specific content can be referred to the description in the method embodiment of the application, which will not be repeated here.

[0087] The device embodiments described above are only schematic, and the units described as separate components can or can not be physically separated, i.e., can be located in one place or distributed on multiple network units. Part or all of the units can be selected according to actual needs to achieve the purpose of the method embodiment.

[0088] In a third aspect, the application provides a data processing device, comprising a processor, the processor is coupled with a memory, the memory stores a program, and the program is executed by the processor, so that the data processing device executes the container technology-based CI / CD service deployment method of the first aspect.

[0089] In a fourth aspect, the application further provides a computer readable storage medium, which stores a computer program, and the computer program is executed by a processor to implement the container technology-based CI / CD service deployment method of the first aspect.

[0090] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by a computer program instructing related hardware, and the program can be stored in a computer readable storage medium. When the program is executed, it can include the processes of the above-mentioned embodiment methods. The storage medium can be a magnetic disk, an optical disk, a read-only memory (ROM) or a random access memory (RAM), etc.

[0091] The above is the preferred embodiment of the application. It should be noted that those skilled in the art can make several improvements and refinements without departing from the principles of the application, and these improvements and refinements are also considered within the protection scope of the application.

Claims

1. A container technology-based CI / CD service deployment method, characterized in that, The application comprises the following steps: In response to the received publishing instruction, a target container image is obtained from a container image library; The target container image is stored in the container image library based on the OCI standard and contains a target program file to be deployed; wherein the construction process of the target container image is that, in response to the received construction instruction, a Dockerfile file is run to construct the target container image corresponding to the target program file; specifically, the target container image comprises a deployment layer, and the deployment layer comprises a deployment layer file source stage, a deployment target file list, a deployment layer base image, and a deployment executor program; wherein the deployment layer file source stage is used to determine the files to be deployed as construction products in the container image construction process; the deployment target file list is used to determine the files to be deployed as construction products from the deployment layer file source stage in the original container image construction process; the deployment layer base image is used to determine the base image storing the deployment target file list from the deployment layer file source stage; and the deployment executor program is stored in the base image of the deployment layer or is injected into a deployment execution container through file mounting when the deployment image is run; The target container image is run to create a deployment execution container, and the target program file is remotely transmitted to a target server; specifically, the target program file is sent to the target server through a publishing channel based on a remote transmission protocol by using a publishing program in the target container image; the publishing channel refers to a transmission channel corresponding to each target server.

2. The container technology-based CI / CD service deployment method according to claim 1, wherein, The construction method of the publishing channel is specifically as follows: The Dockerfile extracts a target file name of the target program file through a preset file extraction program; The target file name is sent to the target server to construct the publishing channel corresponding to the target server. 3.A container technology-based CI / CD service deployment apparatus characterized by comprising: The application comprises the following steps: A construction unit and a publishing unit are provided; wherein The construction unit is used to construct a target container image corresponding to a target program file according to a received construction instruction and store the target container image in a container image library based on the OCI standard; wherein the construction process of the target container image is that, in response to the received construction instruction, a Dockerfile file is run to construct the target container image corresponding to the target program file; specifically, the target container image comprises a deployment layer, and the deployment layer comprises a deployment layer file source stage, a deployment target file list, a deployment layer base image, and a deployment executor program; wherein the deployment layer file source stage is used to determine the files to be deployed as construction products in the container image construction process; the deployment target file list is used to determine the files to be deployed as construction products from the deployment layer file source stage in the original container image construction process; the deployment layer base image is used to determine the base image storing the deployment target file list from the deployment layer file source stage; and the deployment executor program is stored in the base image of the deployment layer or is injected into a deployment execution container through file mounting when the deployment image is run; The publishing unit is configured to obtain the target container image from the container image library in response to the received publishing instruction; run the target container image to create a deployment execution container; and remotely transmit the target program file to a target server; specifically, utilize a publishing program in the target container image to send the target program file to the target server through a publishing channel based on a remote transmission protocol; and the publishing channel refers to a transmission channel corresponding to each target server.

4. The container technology-based CI / CD service deployment apparatus according to claim 3, characterized by, The publishing channel is constructed in the following manner: The Dockerfile extracts a target file name of the target program file through a preset file extraction program; The target file name is sent to the target server to construct the publishing channel corresponding to the target server.

5. A data processing device, characterized by Comprise: A processor coupled to the memory, the memory storing a program, the program being executed by the processor, so that the data processing device executes the container technology-based CI / CD service deployment method of any one of claims 1-2.

6. A computer storage medium, characterized in that The computer storage medium stores computer instructions for executing the container technology-based CI / CD service deployment method of any one of claims 1-2.

Citation Information

Patent Citations

  • Automatic CI / CD project deployment method and storage medium

    CN109814879A

  • Service data backup and extraction method and computer readable medium

    CN110830571A