Unified mirror image service construction method and system and computer readable storage medium
Through the unified image service construction method, the docker image is automatically built, which solves the problems of cumbersome and inefficient development caused by manual image construction in the existing technology, realizes the automated image construction and version management, and improves the development efficiency.
Patent Information
- Application Number
- CN202411212992.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-30
- Publication Date
- 2024-12-06
AI Technical Summary
The existing technology is manual when building docker images, resulting in cumbersome development and confusing image version management, resulting in inefficient development.
Through the unified mirror service construction method, the configuration data of the front-end configuration interface is obtained, the format information field is analyzed, the configuration template of the server is obtained for filling, the script file is generated, and the basic system image in the local database is constructed based on the script file to realize the project system image automated construction.
The automated construction of mirrors is realized, the degree of development automation is improved, developers can focus more on project code development, and the management of mirror versions is simplified.
Smart Images

Figure CN119088507A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of cloud platform technology, and in particular to a unified image service construction method, system and computer-readable storage medium. Background Art
[0002] At present, the deployment of AI projects developed based on Python on the rk series development board of kaihongOS needs to be implemented based on docker images, that is, the project is packaged as a docker image to provide algorithm services, and building images is an important part of it. However, the existing technology builds the docker image of the project in a manual way, which is cumbersome to develop, and the relationship between the image versions increases after the number increases, which is not easy to manage, resulting in low development efficiency. Therefore, how to unify the image building service so that developers can focus more on the code development of the project and realize the automatic construction of the image has become a problem that needs to be solved urgently.
[0003] Therefore, the prior art still needs to be improved and developed. Summary of the invention
[0004] The main purpose of the present invention is to provide a unified image service construction method, system and computer-readable storage medium, aiming to solve the problem in the prior art that images need to be developed manually, the development is cumbersome and thus leads to low development efficiency.
[0005] To achieve the above object, the present invention provides a unified mirror service construction method, the unified mirror service construction method comprising the following steps:
[0006] Acquire configuration data of the front-end configuration interface, analyze the configuration data, and obtain format information fields;
[0007] Obtaining a configuration template of the server, and filling the configuration template according to the format information field to obtain a script file;
[0008] The basic system image in the local database is obtained, and the basic system image is constructed according to the script file to obtain the project system image.
[0009] Optionally, the unified mirror service construction method, wherein the step of acquiring configuration data of the front-end configuration interface and analyzing the configuration data to obtain the format information field specifically includes:
[0010] Collect configuration information of the front-end configuration interface, extract the configuration information, and obtain configuration data;
[0011] Parsing the parameters in the configuration data to obtain a format information field;
[0012] The format information field includes: name, version, description information and Git project address.
[0013] Optionally, the unified image service construction method, wherein the step of obtaining a configuration template of the server and filling the configuration template according to the format information field to obtain a script file, specifically includes:
[0014] Obtaining a project address and target code from a Git server, pulling the target code according to the project address to obtain the project code, and building the project code to obtain a configuration template;
[0015] The configuration template is filled according to the name, the version, the description information and the Git project address to obtain a script file.
[0016] Optionally, the unified image service construction method, wherein the step of obtaining a basic system image in a local database and constructing the basic system image according to the script file to obtain a project system image, specifically includes:
[0017] Obtaining image information from a local database, and determining whether the image information is a basic system image;
[0018] If the image information is a basic system image, the build command in the script file is obtained, and the basic system image is packaged and encapsulated according to the build command to obtain a project system image.
[0019] Optionally, in the unified image service construction method, the step of determining whether the image information is a basic system image further comprises:
[0020] If the image information is not a basic system image, generating a second basic system image according to the script file;
[0021] The second basic system image is constructed according to the script file to obtain a project system image.
[0022] Optionally, the unified image service construction method further comprises:
[0023] Obtaining the user's upload request and configuration information, constructing a target script according to the upload request and the configuration information, and sending the target script to the front-end interface of the client;
[0024] The user's log request is obtained, build log information is collected based on the log request, and the build log information is sent to the front-end interface of the client.
[0025] Optionally, in the unified mirror service construction method, the step of sending the target script to a front-end interface of a client specifically includes:
[0026] Encapsulate and package the target script to obtain a target image file;
[0027] The upload interface of the target image file is called, and the target image file is sent to the front-end interface of the client based on the upload interface.
[0028] In addition, to achieve the above-mentioned purpose, the present invention further provides a unified image service construction system, wherein the unified image service construction system:
[0029] A data acquisition module is used to acquire configuration data of the front-end configuration interface, analyze the configuration data, and obtain a format information field;
[0030] A data filling module is used to obtain a configuration template of the server, fill the configuration template according to the format information field, and obtain a script file;
[0031] The image building module is used to obtain the basic system image in the local database, build the basic system image according to the script file, and obtain the project system image.
[0032] In addition, to achieve the above-mentioned purpose, the present invention also provides a computer-readable storage medium, wherein the computer-readable storage medium stores a unified image service construction program, and when the unified image service construction program is executed by a processor, the steps of the unified image service construction method as described above are implemented.
[0033] In the present invention, configuration data of the front-end configuration interface is obtained, the configuration data is analyzed to obtain the format information field; the configuration template of the server is obtained, the configuration template is filled according to the format information field to obtain a script file; the basic system image in the local database is obtained, the basic system image is constructed according to the script file to obtain a project system image. The present invention obtains configuration data through the front-end configuration interface, analyzes to obtain the format information field; fills the configuration template of the server according to the format information field, constructs the basic system image to obtain the project system image, and can realize the automatic construction of the image and improve the degree of development automation. BRIEF DESCRIPTION OF THE DRAWINGS
[0034] Figure 1 It is a flow chart of a preferred embodiment of the unified mirror service construction method of the present invention;
[0035] Figure 2 It is a flow chart of the service logic of a preferred embodiment of the unified mirror service construction method of the present invention;
[0036] Figure 3 It is a flow chart of the original image packaging method of the preferred embodiment of the unified image service construction method of the present invention;
[0037] Figure 4 It is a flow chart of a unified image service packaging method of a preferred embodiment of the unified image service construction method of the present invention;
[0038] Figure 5 It is a schematic diagram of the principle of a preferred embodiment of the unified mirror service construction system of the present invention;
[0039] Figure 6 It is a schematic diagram of the composition of the terminal control device in a preferred embodiment of the unified mirror service construction system of the present invention. DETAILED DESCRIPTION
[0040] In order to make the purpose, technical solution and advantages of the present invention clearer and more specific, the present invention is further described in detail below with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.
[0041] There are many deficiencies in the existing technology for monitoring the aging process of terminal devices. Because the existing technology builds the docker image of the project manually, the development is cumbersome, and the relationship is chaotic after the number of image versions increases, which is not easy to manage, resulting in low development efficiency. Therefore, a unified image service construction system is needed, which can not only unify the image construction service to enable developers to focus more on the code development of the project, but also realize the method of automatic image construction.
[0042] The unified mirror service construction method described in the preferred embodiment of the present invention is as follows: Figure 1 As shown, the unified mirror service construction method includes the following steps:
[0043] Step S10: Acquire configuration data of the front-end configuration interface, analyze the configuration data, and obtain a format information field.
[0044] Specifically, the configuration information of the front-end configuration interface is collected (the front-end configuration interface is a website, which is opened by the browser to access), the configuration information is extracted to obtain the configuration data; the parameters in the configuration data are parsed to obtain the format information field; wherein the format information field includes: name, version, description information and Git project address (for example: the name of the project Docker image, the version of the project Docker image, the description information of the project Docker image and the Git project address of the image container running server).
[0045] Step S20: Obtain a configuration template from the server, and fill the configuration template according to the format information field to obtain a script file.
[0046] Specifically, the project address and target code of the Git server are obtained, the target code is pulled according to the project address to obtain the project code, the project code is built to obtain a configuration template; the configuration template is filled according to the name, the version, the description information and the Git project address to obtain a script file.
[0047] As an example, Figure 2 As shown, the unified image building service process, the front-end configuration interface (configuration dictionary), obtains the configuration template (fill template) in the cloud, and the pull-down replacement is "corresponding to git pull, pulls the project code of the code hosting platform to the server, obtains the script file, and searches according to the user's configuration information, which will correspond to a basic image, such as os_image = ubuntu:20.04, python_version = 3.8.0, rknn_version = 1.5.2, rk35xx_dir = rk3588. The server backend will use the docker command to match whether the corresponding image already exists. The basic image includes Ubuntu and Rknn libraries, where Ubuntu is the system environment on which the program runs, such as the code program runs on windows and linux. Ubuntu is a distribution based on the Linux operating system. The Rockchip RKNN (Rockchip Neural The RKNN library is a deep learning inference library that is mainly used to perform inference tasks of neural network models on Rockchip processors. This library can help developers deploy and execute deep learning models on Rockchip processors to implement various artificial intelligence applications such as object recognition, image classification, etc. The RKNN library provides an efficient inference engine that accelerates the inference process of neural network models and optimizes performance.
[0048] Step S30: Acquire a basic system image in a local database, and construct the basic system image according to the script file to obtain a project system image.
[0049] Specifically, the image information in the local database is obtained (the image information includes REPOSITORY: the warehouse name of the image, TAG: the tag of the image, IMAGE ID: the unique identifier of the image, CREATED: the creation time of the image, SIZE: the size of the image), and it is determined whether the image information is a basic system image; if the image information is a basic system image, the build command in the script file is obtained, and the basic system image is packaged and encapsulated according to the build command to obtain a project system image; if the image information is not a basic system image, a second basic system image is generated according to the script file ("project image" is built based on "basic image", if the configured basic image is new, the build time will be longer, if the configured basic image already exists in the server, the build time will be correspondingly shorter, and the basic image automatically generates a basic image name from the four fields of "base_image", which can be reused by subsequent projects); the second basic system image is built according to the script file to obtain a project system image.
[0050] Furthermore, the user's upload request and configuration information are obtained, a target script is constructed according to the upload request and the configuration information, and the target script is sent to the front-end interface of the client; the user's log request is obtained, construction log information is collected based on the log request, and the construction log information is sent to the front-end interface of the client, the target script is encapsulated and packaged to obtain a target image file; the upload interface of the target image file is called (the upload interface includes interface one and interface two, as long as interface one successfully returns "url", since interface two is a direct GET request without parameters, the request can generally be successful, unless there are other reasons such as service crash or network interruption), the target image file is sent to the front-end interface of the client based on the upload interface, wherein, after submitting the task and waiting for a certain period of time, the last "success built" can be viewed through the log returned by "interface two", and the image information matching the configuration information can be viewed on the host through the dockerimages command.
[0051] As an example, Figure 3 and Figure 4As shown in the figure, the disadvantages of the original docker image packaging method are: 1. manual writing and manual execution; 2. cumbersome dependency package management; 3. difficult to open; the manual packaging process: write the basic image through the docker file of the basic image, and then build the project image through the project image docker file based on the basic image. The advantages of unified image building are: 1. template filling, automatic execution, 2. unified management of poetry, 3. unified process, open to the outside world; the automatic packaging process: automatically generate the basic image docker file through configuration information to write the basic image, and automatically generate the project image docker file to build the project image, which can realize the automatic construction of the image.
[0052] Furthermore, if Figure 5 As shown, based on the above-mentioned unified image service construction method, the present invention also provides a unified image service construction system, wherein the unified image service construction system includes:
[0053] The data acquisition module 51 is used to acquire the configuration data of the front-end configuration interface, analyze the configuration data, and obtain the format information field;
[0054] A data filling module 52 is used to obtain a configuration template of the server, fill the configuration template according to the format information field, and obtain a script file;
[0055] The image building module 53 is used to obtain the basic system image in the local database, build the basic system image according to the script file, and obtain the project system image.
[0056] Furthermore, if Figure 6 As shown, based on the above-mentioned unified mirror service construction method and system, the present invention also provides a terminal accordingly, and the terminal includes a processor 10, a memory 20 and a display 30. Figure 6 Only some components of the terminal are shown, but it should be understood that it is not required to implement all of the components shown, and more or fewer components may be implemented instead.
[0057] In some embodiments, the memory 20 may be an internal storage unit of the terminal, such as a hard disk or memory of the terminal. In other embodiments, the memory 20 may also be an external storage device of the terminal, such as a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. equipped on the terminal. Further, the memory 20 may also include both an internal storage unit of the terminal and an external storage device. The memory 20 is used to store application software and various types of data installed on the terminal, such as the program code of the installation terminal. The memory 20 may also be used to temporarily store data that has been output or is to be output. In one embodiment, a unified image service construction program 40 is stored on the memory 20, and the unified image service construction program 40 can be executed by the processor 10, thereby realizing the unified image service construction method in the present application.
[0058] In some embodiments, the processor 10 may be a central processing unit (CPU), a microprocessor or other data processing chip, used to run the program code or process data stored in the memory 20, such as executing the unified image service construction method.
[0059] In some embodiments, the display 30 may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, an OLED (Organic Light-Emitting Diode) touch device, etc. The display 30 is used to display information on the terminal and to display a visual user interface. The components 10-30 of the terminal communicate with each other via a system bus.
[0060] In one embodiment, when the processor 10 executes the unified image service construction program 40 in the memory 20, the following steps are implemented:
[0061] Acquire configuration data of the front-end configuration interface, analyze the configuration data, and obtain format information fields;
[0062] Obtaining a configuration template of the server, and filling the configuration template according to the format information field to obtain a script file;
[0063] The basic system image in the local database is obtained, and the basic system image is constructed according to the script file to obtain the project system image.
[0064] The acquiring of the configuration data of the front-end configuration interface and the analysis of the configuration data to obtain the format information field specifically include:
[0065] Collect configuration information of the front-end configuration interface, extract the configuration information, and obtain configuration data;
[0066] Parsing the parameters in the configuration data to obtain a format information field;
[0067] The format information field includes: name, version, description information and Git project address.
[0068] The step of obtaining the configuration template of the server and filling the configuration template according to the format information field to obtain a script file specifically includes:
[0069] Obtaining a project address and target code from a Git server, pulling the target code according to the project address to obtain the project code, and building the project code to obtain a configuration template;
[0070] The configuration template is filled according to the name, the version, the description information and the Git project address to obtain a script file.
[0071] The step of obtaining a basic system image in a local database and constructing the basic system image according to the script file to obtain a project system image specifically includes:
[0072] Obtaining image information from a local database, and determining whether the image information is a basic system image;
[0073] If the image information is a basic system image, the build command in the script file is obtained, and the basic system image is packaged and encapsulated according to the build command to obtain a project system image.
[0074] The step of determining whether the image information is a basic system image comprises:
[0075] If the image information is not a basic system image, generating a second basic system image according to the script file;
[0076] The second basic system image is constructed according to the script file to obtain a project system image.
[0077] The unified mirror service construction method further includes:
[0078] Obtaining the user's upload request and configuration information, constructing a target script according to the upload request and the configuration information, and sending the target script to the front-end interface of the client;
[0079] The user's log request is obtained, build log information is collected based on the log request, and the build log information is sent to the front-end interface of the client.
[0080] The step of sending the target script to the front-end interface of the client specifically includes:
[0081] Encapsulate and package the target script to obtain a target image file;
[0082] The target image file upload interface is called, and the target image file is sent to the server based on the upload interface.
[0083] The present invention also provides a computer-readable storage medium, wherein the computer-readable storage medium stores a unified image service construction program, and when the unified image service construction program is executed by a processor, the steps of the unified image service construction method as described above are implemented.
[0084] In summary, the present invention provides a unified image service construction method, system and computer-readable storage medium, the method comprising: obtaining configuration data of a front-end configuration interface, analyzing the configuration data to obtain a format information field; obtaining a configuration template of a server, filling the configuration template according to the format information field to obtain a script file; obtaining a basic system image in a local database, building the basic system image according to the script file to obtain a project system image. The present invention obtains configuration data through a front-end configuration interface, analyzes to obtain a format information field; fills the configuration template of the server according to the format information field, builds a basic system image to obtain a project system image, and can realize the automated construction of the image and improve the degree of development automation.
[0085] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or terminal system including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or terminal system. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or terminal system including the element.
[0086] Of course, those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing related hardware (such as a processor, a controller, etc.) through a computer program, and the program can be stored in a computer-readable storage medium that can be read by a computer, and the program can include the processes of the above-mentioned method embodiments when executed. The computer-readable storage medium can be a memory, a disk, an optical disk, etc.
[0087] It should be understood that the application of the present invention is not limited to the above examples. For ordinary technicians in this field, improvements or changes can be made based on the above description. All these improvements and changes should fall within the scope of protection of the claims attached to the present invention.
Claims
1. A method for constructing a unified image service, characterized in that: The unified mirror service construction method includes: Acquire configuration data of the front-end configuration interface, analyze the configuration data, and obtain format information fields; Obtaining a configuration template of the server, and filling the configuration template according to the format information field to obtain a script file; The basic system image in the local database is obtained, and the basic system image is constructed according to the script file to obtain the project system image.
2. The unified mirror service construction method according to claim 1, characterized in that: The configuration data of the front-end configuration interface is obtained, and the configuration data is analyzed to obtain the format information field, which specifically includes: Collect configuration information of the front-end configuration interface, extract the configuration information, and obtain configuration data; Parsing the parameters in the configuration data to obtain a format information field; The format information field includes: name, version, description information and Git project address.
3. The unified mirror service construction method according to claim 2, characterized in that: The obtaining of the configuration template of the server, and filling the configuration template according to the format information field to obtain a script file specifically includes: Obtaining a project address and target code from a Git server, pulling the target code according to the project address to obtain the project code, and building the project code to obtain a configuration template; The configuration template is filled according to the name, the version, the description information and the Git project address to obtain a script file.
4. The unified mirror service construction method according to claim 1, characterized in that: The obtaining of the basic system image in the local database and constructing the basic system image according to the script file to obtain the project system image specifically includes: Obtaining image information from a local database, and determining whether the image information is a basic system image; If the image information is a basic system image, the build command in the script file is obtained, and the basic system image is packaged and encapsulated according to the build command to obtain a project system image.
5. The unified mirror service construction method according to claim 4, characterized in that: The step of determining whether the image information is a basic system image comprises: If the image information is not a basic system image, generating a second basic system image according to the script file; The second basic system image is constructed according to the script file to obtain a project system image.
6. The unified mirror service construction method according to claim 1, characterized in that: The unified mirror service construction method also includes: Obtaining the user's upload request and configuration information, constructing a target script according to the upload request and the configuration information, and sending the target script to the front-end interface of the client; The user's log request is obtained, build log information is collected based on the log request, and the build log information is sent to the front-end interface of the client.
7. The unified mirror service construction method according to claim 6, characterized in that: The sending of the target script to the front-end interface of the client specifically includes: Encapsulate and package the target script to obtain a target image file; The upload interface of the target image file is called, and the target image file is sent to the front-end interface of the client based on the upload interface.
8. A unified image service construction system, characterized in that: The unified image service construction system includes: A data acquisition module is used to acquire configuration data of the front-end configuration interface, analyze the configuration data, and obtain a format information field; A data filling module is used to obtain a configuration template of the server, fill the configuration template according to the format information field, and obtain a script file; The image building module is used to obtain the basic system image in the local database, build the basic system image according to the script file, and obtain the project system image.
9. A terminal, characterized in that: The terminal includes: a memory, a processor, and a unified image service construction program stored in the memory and executable on the processor. When the unified image service construction program is executed by the processor, the steps of the unified image service construction method according to any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a unified image service construction program, and when the unified image service construction program is executed by a processor, the steps of the unified image service construction method according to any one of claims 1 to 7 are implemented.
