Mirror image construction method, system and device, readable storage medium and program product
By compiling and generating installation package files for the software source code, and using the configuration information and basic image of the target image to build the target image, the problem of low image construction efficiency in the existing technology is solved, and fast and efficient image construction and management is achieved.
Patent Information
- Application Number
- CN202411768977.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-04
- Publication Date
- 2025-03-07
AI Technical Summary
The prior art requires rebuilding the image when the application is updated, resulting in low image building efficiency.
By compiling the software source code, generating the installation package file, and obtaining the configuration information of the target image, including the version information of the installation package file, the target image is built based on this information and the basic image.
It quickly builds target images that match the version information of the installation package file, improves the efficiency of image construction, and avoids confusion in usage caused by excessive mirror versions.
Smart Images

Figure CN119576354A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to an image building method, system, computer device, computer-readable storage medium, and computer program product. Background Art
[0002] With the rapid development of the Internet and artificial intelligence technologies, more and more algorithms and models are packaged into various applications for users, greatly improving people's convenience in life and work efficiency. However, these applications need to run in the corresponding operating environment. For example, in the field of deep learning, model training, evaluation, and reasoning processes all rely on different operating environments.
[0003] The image includes the code and dependent environment required to run the program. Since the application is updated quickly, multiple versions of images are also required. In the related art, the image of the corresponding program is rebuilt every time the program is updated, and the image building efficiency is low. Summary of the invention
[0004] Based on this, it is necessary to provide an image building method, system, computer device, computer readable storage medium and computer program product that can improve the efficiency of image building in response to the above technical problems.
[0005] In a first aspect, the present application provides a mirror image construction method, comprising:
[0006] Compile the software source code to obtain the compilation result;
[0007] If the compilation result is successful, generating an installation package file corresponding to the software source code;
[0008] Obtaining configuration information of the target image; the configuration information includes version information of the installation package file;
[0009] Based on the configuration information of the target image and the base image, a target image corresponding to the version information of the installation package file is constructed.
[0010] In one embodiment, obtaining the configuration information of the target image includes:
[0011] In response to the mirror configuration trigger operation, displaying a mirror configuration interface, wherein the mirror configuration interface displays at least one preset mirror information;
[0012] In response to the selection trigger of the at least one preset image information, the configuration information of the target image is acquired.
[0013] In one embodiment, the method further comprises:
[0014] Sending the installation package file to the cloud to instruct the cloud to assign corresponding version information to the installation package file and save the installation package file;
[0015] The step of obtaining the configuration information of the target image includes:
[0016] Obtaining version information of the installation package file from the cloud;
[0017] Get the input configuration information except the version information;
[0018] The configuration information of the target image is obtained according to the version information and the remaining configuration information.
[0019] In one embodiment, compiling the software source code to obtain the compilation result includes:
[0020] In response to an upload operation of source code under a target branch of the code repository, selecting the latest uploaded software source code from the target branch of the code repository;
[0021] The latest uploaded software source code is compiled to obtain the compilation result.
[0022] In a second aspect, the present application also provides an image building system, the system comprising a code compilation component, a storage component and an image production component; wherein,
[0023] The code compilation component is used to compile the software source code to obtain a compilation result, and if the compilation result is successful, generate an installation package file corresponding to the software source code, and send the installation package file to the storage component;
[0024] The storage component is used to assign version information to the installation package file sent by the code compilation component and save the installation package file;
[0025] The image making component is used to obtain configuration information of the target image, wherein the configuration information includes version information of the installation package file; and based on the configuration information of the target image and the base image, construct the target image corresponding to the version information of the installation package file.
[0026] In one of the embodiments, the image production component is further used to obtain version information of the installation package file from the storage component.
[0027] In one of the embodiments, the image making component is further used to send the target image to the storage component;
[0028] The storage component is also used to save the target image sent by the image production component;
[0029] The system also includes a code running component, which is used to download and install the target installation package file from the storage component, obtain the target image corresponding to the target installation package file from the storage component, and run the application corresponding to the target installation package file in the target image.
[0030] In a third aspect, the present application further provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the steps of the image building method provided in the first aspect are implemented.
[0031] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the steps of the image building method provided in the first aspect are implemented.
[0032] In a fifth aspect, the present application also provides a computer program product, including a computer program, which, when executed by a processor, implements the steps of the image building method provided in the first aspect.
[0033] The above-mentioned image building method, system, computer device, computer-readable storage medium and computer program product compile the software source code to obtain a compilation result. When the compilation result is successful, an installation package file corresponding to the software source code is generated, and configuration information of the target image is obtained, wherein the configuration information includes version information of the installation package file. Based on the configuration information of the target information and the basic image, a target image corresponding to the version information of the installation package file is constructed. The target image that matches the version information of the installation package file can be quickly constructed based on the basic image and the configuration information, and the efficiency of image construction can be improved. At the same time, the constructed target image corresponds to the version information of the installation package file, and the constructed image can be bound to the installation package file version to avoid confusion in image use due to multiple image versions. BRIEF DESCRIPTION OF THE DRAWINGS
[0034] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the drawings required for use in the embodiments of the present application or related technical descriptions will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
[0035] Figure 1 An application environment diagram of a mirror image building method in an embodiment;
[0036] Figure 2 The following is a flowchart of a method for building an image in one embodiment;
[0037] Figure 3 A schematic diagram of a mirror configuration interface in an embodiment;
[0038] Figure 4 It is a flowchart of a mirror image building method in another embodiment;
[0039] Figure 5 A schematic diagram of the structure of an image building system in one embodiment;
[0040] Figure 6 A schematic diagram of the structure of an image building system in another embodiment;
[0041] Figure 7 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0042] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0043] The mirror image construction method provided in the embodiment of the present application can be applied to Figure 1In the application environment shown. Among them, the terminal 102 communicates with the cloud 104 through the network. The data storage system can store the data that the cloud 104 needs to process. The data storage system can be integrated on the cloud 104, or it can be placed on other clouds or other network servers. The terminal 102 obtains the software source code, compiles the software source code, and obtains the compilation result. When the compilation result is successful, the installation package file corresponding to the software source code is generated. The terminal 102 can send the installation package file to the cloud 104 for storage, and the cloud 104 can assign version information to the received installation package file; the terminal 102 obtains the configuration information of the target image, and the configuration information includes the version information of the installation package file. Based on the configuration information of the target image and the basic image, the target image corresponding to the version information of the installation package file is constructed. The terminal 102 can send the target image to the cloud 104, and the cloud 104 saves and manages the target image. Among them, the terminal 102 can be, but not limited to, various personal computers, laptops, smart phones, tablet computers, Internet of Things devices and portable wearable devices. The Internet of Things devices can be smart speakers, smart TVs, smart air conditioners, smart car devices, projection devices, etc. The portable wearable device may be a smart watch, a smart bracelet, a head-mounted device, etc. The head-mounted device may be a virtual reality (VR) device, an augmented reality (AR) device, smart glasses, etc. The cloud 104 may be an independent physical server, a server cluster or a distributed system composed of multiple physical servers, or a cloud server providing cloud computing services.
[0044] In an exemplary embodiment, Figure 2 As shown, a mirror image construction method is provided, which is applied to Figure 1 The terminal in the example is used to illustrate, including the following steps 202 to 208. Among them:
[0045] Step 202, compile the software source code to obtain a compilation result.
[0046] Among them, software source code refers to the source code of the application program. The application program can be a system application or a third-party application, or an operating system. Source code refers to an uncompiled text file written in accordance with the programming language specification. It is a human-readable computer language instruction. Software source code can include source code in multiple formats, such as C / C++, BASIC, C#, JAVA, PASCAL and other high-level languages, or assembly language ASM, etc. The format of the software source code can be selected according to the actual application scenario.
[0047] The software source code is compiled based on the code compilation environment to obtain a compilation result. The software source code can be compiled through a variety of compilation environments to obtain a corresponding compilation result. The compilation process is equivalent to the process of converting the software source code into a process that can be understood and executed by the machine, and the compilation result is used to characterize the computer's recognition result of the software source code. Exemplarily, the software source code is compiled in the corresponding compilation environment to obtain a compilation result, and the compilation result can include compilation success and compilation failure. If the compilation result is compilation failure, an error prompt can also be issued.
[0048] Step 204: if the compilation result is successful, generate an installation package file corresponding to the software source code.
[0049] The installation package file refers to a set of files packaged to facilitate software installation, configuration and management. The installation package file may include the software's executable file, library file, configuration file, and documentation. The formats of the installation package file may include .exe (Windows executable file), .msi (Windows Installer package), .dmg (macOS disk image file), .pkg (macOS installation package), .deb (installation package for Debian and its derivatives such as Ubuntu), .rpm (installation package for Red Hat and its derivatives such as Fedora), etc.
[0050] Optionally, when the compilation result is successful, an installation package file corresponding to the software source code is generated; when the compilation result is a compilation failure, an error prompt of compilation failure can be issued, and at the same time, it is prohibited to merge the corresponding software source code into the corresponding branch of the code repository or to save the software source code in the code repository.
[0051] Optionally, the terminal can send the generated installation package file to the cloud, assign the corresponding version information through the cloud, and save and version manage the installation package file. The terminal can also send an installation package download request to the cloud when necessary, and the installation package download request can include the version information of the downloaded installation package, and then download the installation package file of the corresponding version from the cloud.
[0052] Step 206, obtaining configuration information of the target image; wherein the configuration information includes version information of the installation package file.
[0053] The configuration information refers to the parameter information of the target image, which is used to build the target image. The configuration information includes the version information of the installation package file, and may also include the version of the target image, hardware platform, operating system, programming language, installation method, graphics card, and driver information.
[0054] Optionally, the configuration information of the input target image can be obtained, that is, all the configuration information of the target image is obtained through input. Alternatively, part of the configuration information can be obtained through the cloud and the other part can be obtained through input, for example, the version information of the installation package file can be obtained through the cloud, and the rest of the configuration information except the version information of the installation package file can be obtained through input.
[0055] Step 208: construct a target image corresponding to the version information of the installation package file based on the configuration information of the target image and the base image.
[0056] The base image is used to represent the general image architecture, and the base image can be the image architecture corresponding to the software source code of the same software type or the software source code of the same software. The target image can be constructed based on the base image and combined with the configuration parameters of the target image.
[0057] Optionally, the terminal can obtain the base image from the cloud. The cloud stores the built image, and the terminal can send a base image acquisition request to the cloud, and then obtain the base image from the cloud. Exemplarily, the terminal obtains the configuration information of the target image from the configuration interface, triggers the preset control of the configuration interface, sends a base image acquisition request to the cloud, and the cloud sends the base image to the terminal according to the base image acquisition request.
[0058] Optionally, the terminal may send the target image corresponding to the version information of the constructed installation package file to the cloud for storage via the cloud. The target image sent to the cloud may include an image identifier of the target image, and the image identifier may include the version information of the corresponding installation package file and the target image version information, thereby associating and binding the image with the installation package file of the corresponding version from the identifier.
[0059] In an exemplary application scenario, the terminal obtains a download request for a target application, and based on the download request for the target application, the terminal sends a request to the cloud to obtain the installation package file of the target application, and the cloud sends the installation package file corresponding to the acquisition request to the terminal. In response to the installation request for the installation package file of the target application, the terminal requests the cloud to download a target image corresponding to the installation package file of the target application, and then installs the installation package file of the target application based on the target image, or runs the target application based on the target image.
[0060] In the above-mentioned image building method, the software source code is compiled to obtain a compilation result. When the compilation result is successful, an installation package file corresponding to the software source code is generated, and configuration information of the target image is obtained, the configuration information including the version information of the installation package file. Based on the configuration information of the target information and the basic image, a target image corresponding to the version information of the installation package file is constructed. The target image that matches the version information of the installation package file can be quickly constructed based on the basic image and the configuration information, which can improve the efficiency of image construction. At the same time, the constructed target image corresponds to the version information of the installation package file, which can facilitate the binding of the constructed image with the installation package file version, avoiding the situation where multiple image versions lead to confusion in image use.
[0061] In an exemplary embodiment, obtaining the configuration information of the target image in step 206 includes:
[0062] In response to the image configuration trigger operation, the image configuration interface is displayed, and the image configuration interface displays at least one preset image information; in response to the selection trigger of the at least one preset image information, the configuration information of the target image is obtained.
[0063] The mirror configuration trigger operation refers to an operation that triggers mirror configuration, such as triggering a mirror configuration control, opening a mirror configuration interface, or obtaining a mirror configuration command, etc. The mirror configuration interface is an interface for configuring mirror parameters.
[0064] Optionally, in response to a mirror configuration trigger operation, a mirror configuration interface is displayed, the mirror configuration interface displays a plurality of preset mirror information, each preset mirror information includes at least one mirror information option, in the mirror information options corresponding to each preset mirror information, in response to a selection trigger of a target mirror information option, the target mirror information corresponding to the corresponding preset mirror information is obtained, and the target mirror information corresponding to the various preset mirror information is used as the configuration information of the target mirror.
[0065] In an example, the image configuration interface is as follows Figure 3 As shown, the image configuration interface displays a variety of preset image information such as version, hardware platform, operating system, programming language and installation method. Each preset image information includes at least one image option information. For example, the version includes image information options such as 2.3.0-rc2, 2.2.14 and Nightly, and the operating system includes image information options such as Linux-aarch64, Linux-x86_64, and Windows-x64. In response to the selection trigger of the image option information in each preset image information, the target image option information is obtained, and the configuration information of the target image is obtained according to the target image option information corresponding to the various preset image information, such as Figure 3The configuration information of the target image obtained in the example includes: version 2.3.0-rc2, hardware platform Ascend, operating system Linux-aarch64, programming language Python3.7, and installation method Pip.
[0066] In this embodiment, by responding to the image configuration trigger operation, the image configuration interface is displayed, and the image configuration interface displays at least one preset image information. In response to the selection trigger of at least one preset image information, the configuration information of the target image is obtained. The configuration information of the target image can be conveniently obtained from a visualization perspective, thereby improving the freedom and flexibility of the target image configuration, thereby improving the efficiency of obtaining the configuration information of the target image.
[0067] In some embodiments, the above method further comprises:
[0068] Send the installation package file to the cloud to instruct the cloud to assign corresponding version information to the installation package file and save the installation package file;
[0069] In step 206, the configuration information of the target image is obtained, including:
[0070] Obtain the version information of the installation package file from the cloud; obtain the input configuration information other than the version information; and obtain the configuration information of the target image based on the version information and the other configuration information.
[0071] The terminal can send the installation package file to the cloud to instruct the cloud to assign the corresponding version information to the installation package file, and save the installation package file and the corresponding file information. The cloud can manage the installation package files of different versions. When the terminal is building the target image, it can obtain the version information of the corresponding installation package file from the cloud, and obtain the input configuration information other than the version information, and obtain the configuration information of the target image according to the version information of the installation package file and the remaining configuration information.
[0072] Exemplarily, the terminal can initiate a request to obtain the installation package file version information to the cloud in response to the image configuration trigger operation, and display the image configuration interface; the cloud sends the installation package file version information corresponding to the acquisition request to the terminal based on the corresponding acquisition request, and the terminal obtains the remaining configuration information except the version information based on the image configuration interface, and uses the installation package file version information and the remaining configuration information as the configuration information of the target image.
[0073] In this embodiment, the installation package file is sent to the cloud to instruct the cloud to assign corresponding version information to the installation package file, and the installation package file and corresponding file information are saved, and then the version information of the installation package file is obtained from the cloud, and the remaining configuration information except the version information is obtained. According to the version information of the installation package file and the remaining configuration information, the configuration information of the target image is obtained, and the configuration information of the target image can be obtained from multiple channels, thereby improving the efficiency of obtaining the configuration information of the target image.
[0074] In some embodiments, the step 202 of compiling the software source code to obtain the compilation result includes:
[0075] In response to the source code upload operation under the target branch of the code repository, the latest uploaded software source code is selected from the target branch of the code repository; the latest uploaded software source code is compiled to obtain a compilation result.
[0076] The code repository is used to store and manage source code and source code update information. Code versions are usually controlled and managed through branches in the code repository, allowing developers to develop new features, fix bugs, or make other experimental changes without interfering with the main code line (also called the main branch). The target branch can be any branch in the code repository.
[0077] Optionally, in response to the triggering of the source code upload operation under the target branch of the code repository, the terminal can select the latest uploaded software source code from the target branch of the code repository according to the source code upload time, compile the latest uploaded software source code, and obtain the compilation result.
[0078] In this embodiment, by responding to the source code upload operation under the target branch of the code warehouse, the latest uploaded software source code is selected from the target branch of the code warehouse; the latest uploaded software source code is compiled to obtain the compilation result. It is possible to trigger the source code upload operation to automatically select the latest uploaded software source code for compilation to obtain the compilation result, thereby reducing the number of compilation times and improving the compilation efficiency.
[0079] In an exemplary embodiment, Figure 4 As shown, the image building method includes the following steps 402 to 410.
[0080] Step 402: The terminal obtains the software source code and compiles the software source code to obtain a compilation result.
[0081] Step 404: When the compilation result is successful, the terminal generates an installation package file corresponding to the software source code, and sends the installation package file to the cloud.
[0082] Step 406: The cloud assigns corresponding version information to the received installation package file, and saves the installation package file and corresponding file information.
[0083] Step 408: The terminal obtains configuration information of the target image; the configuration information includes version information of the installation package file.
[0084] Step 410: The terminal constructs a target image corresponding to the version information of the installation package file based on the configuration information of the target image and the base image, and sends the target image to the cloud for storage.
[0085] It is easy to understand that the meanings of the terms and steps in step 402 to step 410 of this embodiment can be found in the explanations and descriptions of the corresponding terms and steps in the above embodiments, and will not be repeated here.
[0086] In the above embodiment, the software source code is compiled through the terminal, and an installation package file is generated after successful compilation. The installation package file is sent to the cloud for storage and management. When building the target image, a target image matching the version of the installation package file is built based on the configuration information and the base image, which can improve the image building efficiency, and associate the installation package file with the image based on the version information in the cloud, which facilitates image management and avoids confusion in image use.
[0087] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0088] Based on the same inventive concept, the embodiment of the present application also provides a mirror image construction device for implementing the mirror image construction method involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in one or more mirror image construction device embodiments provided below can refer to the limitations of the mirror image construction method above, and will not be repeated here.
[0089] In an exemplary embodiment, an image building device is provided, comprising: a code compilation module, an installation package generation module, a configuration information acquisition module and an image building module, wherein:
[0090] A code compilation module is used to compile the software source code and obtain the compilation result;
[0091] The installation package generation module is used to generate the installation package file corresponding to the software source code when the compilation result is successful;
[0092] A configuration information acquisition module is used to obtain the configuration information of the target image; the configuration information includes the version information of the installation package file;
[0093] The image building module is used to build a target image corresponding to the version information of the installation package file based on the configuration information of the target image and the base image.
[0094] In some embodiments, the configuration information acquisition module is further used to display an image configuration interface in response to an image configuration trigger operation, wherein the image configuration interface displays at least one preset image information; and to acquire configuration information of the target image in response to a selection trigger of at least one preset image information.
[0095] In some embodiments, the image building device further includes an installation package sending module, which is used to send the installation package file to the cloud to instruct the cloud to assign corresponding version information to the installation package file and save the installation package file;
[0096] The configuration information acquisition module is also used to obtain version information of the installation package file from the cloud; obtain other configuration information except the version information; and obtain configuration information of the target image according to the version information and other configuration information.
[0097] In some embodiments, the code compilation module is further used to respond to the source code upload operation under the target branch of the code warehouse, select the latest uploaded software source code from the target branch of the code warehouse; compile the latest uploaded software source code to obtain a compilation result.
[0098] Each module in the above-mentioned image building device can be implemented in whole or in part by software, hardware and a combination thereof. Each of the above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory in the computer device in the form of software, so that the processor can call and execute the operations corresponding to each of the above modules.
[0099] In an exemplary embodiment, Figure 5 As shown, a mirror image construction system is provided, which includes a code compilation component 510, a storage component 520 and a mirror image production component 530; wherein,
[0100] The code compilation component 510 is used to compile the software source code to obtain a compilation result, and if the compilation result is successful, generate an installation package file corresponding to the software source code, and send the installation package file to the storage component 520;
[0101] The storage component 520 is used to assign version information to the installation package file sent by the code compilation component and save the installation package file;
[0102] The image making component 530 is used to obtain the configuration information of the target image, which includes the version information of the installation package file; and to construct the target image corresponding to the version information of the installation package file based on the configuration information of the target image and the base image.
[0103] The code compilation component 510 may be, for example, a code compiler or a code compilation device, the storage component 520 may be, for example, a computer-readable storage medium, a cloud or a server, etc., and the image production component 530 refers to a component for producing an image, such as an image production device. It is easy to understand that the meanings of the terms and execution steps in the image construction system can be found in the description and explanation of the corresponding terms and steps in the above-mentioned image construction method embodiment, which will not be repeated here.
[0104] Optionally, the image making component 530 can be used to obtain the version information of the installation package file from the storage component 520, and obtain the remaining configuration information except the version information of the installation package file, and obtain the configuration information of the target image according to the version information of the installation package file and the remaining configuration information.
[0105] Optionally, the image production component 530 can be used to display an image configuration interface in response to an image configuration trigger operation, the image display interface displays at least one preset image information, and obtain the configuration information of the target image in response to a selection trigger of at least one preset image information.
[0106] Optionally, the code compilation component 520 is further configured to respond to a source code upload operation under a target branch of the code repository, select the latest uploaded software source code from the target branch of the code repository, and compile the latest uploaded software source code to obtain a compilation result.
[0107] In this embodiment, the software source code is compiled by the code compilation component. When the compilation result is successful, an installation package file corresponding to the software source code is generated, and the installation package file is sent to the storage component. The storage component assigns version information to the installation package file, and saves the installation package file and the corresponding file information. The image production component obtains the configuration information of the target image, and builds the target image corresponding to the version information of the installation package file based on the configuration information and the basic image. It can realize end-to-end automatic image construction without the need to gradually build and run containers on the bare metal, thereby improving the efficiency and flexibility of image construction. At the same time, multiple different versions of images can be built and managed, and the image version can be bound to the corresponding installation package file version to avoid confusion caused by too many image versions.
[0108] In some embodiments, the image making component 530 is further used to obtain version information of the installation package file from the storage component, and can quickly and accurately obtain the version information of the installation package file.
[0109] In some embodiments, the image production component 530 is also used to send the target image to the storage component 520; the storage component 520 is also used to save the target image sent by the image production component; the image building system also includes a code running component, which is used to download and install the target installation package file from the storage component, obtain the target image corresponding to the target installation package file from the storage component, and run the application corresponding to the target installation package file in the target image.
[0110] Exemplarily, the image production component 530 sends the constructed target image to the storage component 520, the storage component 520 saves the target image, the code running component initiates a download request for the target installation package file to the storage component 520, the storage component 520 sends the target installation package file to the code running component based on the download request, the code running component installs the target installation package file, and then sends a request to obtain the target image corresponding to the target installation package file to the storage component 520, the storage component sends the corresponding target image to the code running component based on the acquisition request, and the code running component runs the application corresponding to the installed target installation package file based on the target image.
[0111] In this embodiment, by saving the image file of the target image through the storage component, the image file of the target image and the corresponding installation package file can be saved and managed, avoiding the problem of confusion in image usage due to multiple versions, while reducing the storage pressure of the terminal and improving the running speed of the terminal.
[0112] In an exemplary embodiment, Figure 6As shown, the image building based on docker is used as an example for explanation. The image building system includes a terminal and a cloud, wherein the terminal is provided with a code compilation environment and an image production environment. Docker is an open source containerization platform that allows developers to encapsulate their applications and all their dependencies into a standardized unit, which is called a "container". The terminal obtains the software source code uploaded to the gitlab code repository, and in response to the upload operation of the software source code, compiles the software source code based on the compilation environment to obtain the compilation result. If the compilation result is a successful compilation, the installation package file whl file corresponding to the software source code is generated, and the whl file is sent to the cloud for storage. The cloud assigns the corresponding version number to the whl file and performs version management on the whl file; if the compilation result is a compilation failure, a compilation error alarm is issued, and the uploaded software source code is prevented from being merged into a specific branch, which can reduce the number of code file versions. The whl file (wheel file) is a binary distribution format of Python, which is used to easily install Python software packages.
[0113] The terminal can obtain the version information of the installation package file from the cloud, obtain the remaining input configuration information, use the version information of the installation package file and the remaining configuration information as the configuration information of the target image, obtain the basic image from the harbor image repository, build the target image corresponding to the version information of the installation package file based on the configuration information of the basic image and the target image based on the image production environment, and upload the target image to the harbor image repository in the cloud for storage. Among them, the harbor image repository can be stored in a cloud different from the cloud where the installation package file is located, that is, the installation package file can be stored in the first cloud, and the harbor image repository can be stored in the second cloud, or the installation package file can be stored in the second cloud, and the harbor image repository can be stored in the first cloud, and the first cloud and the second cloud are different clouds. Alternatively, the harbor image repository and the installation package file can be stored in the same cloud.
[0114] The above-mentioned image building system automatically triggers compilation, generates a whl file after successful compilation and uploads it to the cloud for version management, makes the target image based on the configuration information and the basic image, and then uploads it to the image warehouse for image management, which helps to form a complete pipeline from image development to delivery, improves the efficiency of image building, and realizes image building freely and flexibly. At the same time, different versions of images are managed in the cloud to avoid confusion caused by multiple image versions.
[0115] In an exemplary embodiment, a computer device is provided. The computer device may be a terminal, and its internal structure diagram may be as shown in FIG. Figure 7As shown. The computer device includes a processor, a memory, an input / output interface, a communication interface, a display unit and an input device. The processor, the memory and the input / output interface are connected through a system bus, and the communication interface, the display unit and the input device are connected to the system bus through the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The input / output interface of the computer device is used to exchange information between the processor and the external device. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be implemented through WIFI, a mobile cellular network, near field communication (NFC) or other technologies. When the computer program is executed by the processor, a mirror image construction method is implemented. The display unit of the computer device is used to form a visually visible picture, which can be a display screen, a projection device or a virtual reality imaging device. The display screen can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covering the display screen, or a button, trackball or touchpad set on the computer device shell, or an external keyboard, touchpad or mouse.
[0116] Those skilled in the art will understand that Figure 7 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0117] In an exemplary embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the steps of the image building method in the above embodiment are implemented.
[0118] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps of the image building method in the above embodiment are implemented.
[0119] In one embodiment, a computer program product is provided, including a computer program, which implements the steps of the image building method in the above embodiment when executed by a processor.
[0120] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant regulations.
[0121] A person of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment method can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, an artificial intelligence (AI) processor, etc., but are not limited to this.
[0122] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.
[0123] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. A mirror image construction method, characterized in that: The method comprises: Compile the software source code to obtain the compilation result; If the compilation result is successful, generating an installation package file corresponding to the software source code; Obtaining configuration information of the target image; the configuration information includes version information of the installation package file; Based on the configuration information of the target image and the base image, a target image corresponding to the version information of the installation package file is constructed.
2. The method according to claim 1, characterized in that The step of obtaining the configuration information of the target image includes: In response to the mirror configuration trigger operation, displaying a mirror configuration interface, wherein the mirror configuration interface displays at least one preset mirror information; In response to the selection trigger of the at least one preset image information, the configuration information of the target image is acquired.
3. The method according to claim 1, characterized in that The method further comprises: Sending the installation package file to the cloud to instruct the cloud to assign corresponding version information to the installation package file and save the installation package file; The step of obtaining the configuration information of the target image includes: Obtaining version information of the installation package file from the cloud; Get the input configuration information except the version information; The configuration information of the target image is obtained according to the version information and the remaining configuration information.
4. The method according to claim 1, characterized in that: The software source code is compiled to obtain a compilation result, including: In response to an upload operation of source code under a target branch of the code repository, selecting the latest uploaded software source code from the target branch of the code repository; The latest uploaded software source code is compiled to obtain the compilation result.
5. A mirror image building system, characterized in that: The system includes a code compilation component, a storage component and an image production component; wherein, The code compilation component is used to compile the software source code to obtain a compilation result, and if the compilation result is successful, generate an installation package file corresponding to the software source code, and send the installation package file to the storage component; The storage component is used to assign version information to the installation package file sent by the code compilation component and save the installation package file; The image making component is used to obtain configuration information of the target image, wherein the configuration information includes version information of the installation package file; and based on the configuration information of the target image and the base image, construct the target image corresponding to the version information of the installation package file.
6. The image building system according to claim 5, characterized in that: The image making component is also used to obtain version information of the installation package file from the storage component.
7. The image building system according to claim 5, characterized in that: The image making component is also used to send the target image to the storage component; The storage component is also used to save the target image sent by the image production component; The system also includes a code running component, which is used to download and install the target installation package file from the storage component, obtain the target image corresponding to the target installation package file from the storage component, and run the application corresponding to the target installation package file in the target image.
8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 4 are implemented.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 4 are implemented.
10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 4 are implemented.
