Application mirror image generation method and device, server, medium and product

By obtaining resource files from the original distribution package of the target project in container technology, performing consistency comparison and file addition of static resource images, and generating application images, the problem of low image reusability is solved and the reuse of images is improved. sex.

CN118656175APending Publication Date: 2024-09-17CCB FINTECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410894796.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-04
Publication Date
2024-09-17

AI Technical Summary

Technical Problem

In the existing container technology, image reusability is low, and more complex and scattered static resource files cannot be effectively reused, resulting in reduced image reusability.

Method used

By obtaining resource files from the original distribution package of the target project, it is determined whether there is a static resource image in the container. If it exists, a consistency comparison is performed. The missing files are added to the application image script file based on the comparison results to generate an initial application image script. file, and execute the final application image building command to generate the application image.

Benefits of technology

The reusability of the image is improved. By reusing the static resource files in the original distribution package, the resource reuse capability of the image is enhanced.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118656175A
    Figure CN118656175A
Patent Text Reader

Abstract

The invention provides an application mirror image generation method and device, a server, a medium and a product. Relates to the technical field of big data. The method comprises the following steps: obtaining a static resource file from an original distribution package of a target project, and storing the static resource file in a static resource construction directory; if it is judged that the static resource mirror image exists in the container and the static resource mirror image of the target project does not change, static resource files related to the static resource mirror image are subjected to consistency comparison with static resource files under the static resource construction catalog, and missing files, application resource files and the static resource mirror image are subjected to static resource storage. Deleting a command line of a static resource file in the application resource file, and adding the command line to the application mirror image script file template to obtain a final application mirror image script file; and executing the final application mirror image script file through the application mirror image construction command under the application mirror image construction directory to generate an application mirror image. According to the method provided by the invention, the reusability of the mirror image is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of big data technology, and in particular to a method, device, server, medium and product for generating an application image. Background Art

[0002] In container technology, an image is a read-only file system template that contains all the dependencies, codes, libraries, runtime environments, and configuration files required to run a project, and has the feature of resource reuse.

[0003] At present, the existing technology separates the original distribution package into variable resource files and immutable resource files through resource separation, and builds the application image by reusing the immutable resource image.

[0004] However, this method of the prior art does not propose reuse of more complex and scattered static resource files in the original distribution package, which reduces the reusability of the image. Summary of the invention

[0005] The present application provides a method, device, server, medium and product for generating an application image, so as to solve the problem of low image reusability.

[0006] In a first aspect, the present application provides a method for generating an application image, comprising:

[0007] Obtain multiple resource files from the original distribution package of the target project; obtain application resource files and basic dependent resource files from the multiple resource files, and obtain static resource files from the application resource files and basic dependent resource files; save the static resource files to the static resource build directory; determine whether there is a static resource image in the container; if it is determined that there is a static resource image in the container and the static resource image of the target project has not changed, then compare the static resource files involved in the static resource image with the static resource files in the static resource build directory to obtain a consistency comparison result; if the consistency comparison result is determined to be missing files, then add the missing files, application resource files and static resource images to the application image script file template to generate an initial application image script file; add the command line for deleting the static resource files in the application resource file to the initial application image script file to obtain a final application image script file; save the final application image script file to the application image build directory, and execute the final application image script file through the application image build command in the application image build directory to generate an application image for the target project.

[0008] In one possible design, the static resource files involved in the static resource image are compared with the static resource files under the static resource build directory for consistency to obtain a consistency comparison result, including: comparing the hash values ​​corresponding to the static resource files involved in the static resource image with the hash values ​​corresponding to the static resource files under the static resource build directory to obtain a consistency comparison result.

[0009] In one possible design, application resource files and basic dependent resource files are obtained from multiple resource files, and static resource files are obtained from the application resource files and basic dependent resource files, including: obtaining application resource files and basic dependent resource files from multiple resource files according to the directory structure of multiple resource files; obtaining static resource files from application resource files according to the directory structure of application resource files; obtaining static resource files from basic dependent resource files according to the directory structure of basic dependent resource files.

[0010] In a possible design, after determining whether there is a static resource image in the container, it also includes: if it is determined that there is no static resource image in the container, or if it is determined that there is a static resource image in the container but the static resource image of the target project has changed, then determining whether there is a basic dependency image in the container; if it is determined that there is a basic dependency image in the container, then generating a static resource image script file based on the basic dependency image and the static resource file; saving the static resource image script file to a static resource build directory, and executing the static resource image script file through a static resource image build command in the static resource build directory to generate a static resource image.

[0011] In a possible design, after determining whether there is a base dependency image in the container, the following further includes: if it is determined that there is no base dependency image in the container, or if it is determined that there is a base dependency image in the container but the base dependency image of the target project has changed, then generating a base dependency image script file according to a preset base image and a base dependency resource file; saving the base dependency image script file to a base dependency image build directory, and executing the base dependency image script file through a base dependency image build command in the base dependency image build directory to generate a base dependency image.

[0012] In a possible design, it also includes: pushing the application image, static resource image and basic dependency image to the enterprise private image warehouse, and setting the warehouse address of the enterprise private image warehouse in the configuration file of the target project.

[0013] In a second aspect, the present application provides a device for generating an application image, comprising:

[0014] The first acquisition module is used to acquire multiple resource files from the original distribution package of the target project.

[0015] The second acquisition module is used to acquire application resource files and basic dependent resource files from multiple resource files, and acquire static resource files from the application resource files and basic dependent resource files.

[0016] The save module is used to save static resource files to the static resource build directory.

[0017] The judgment module is used to judge whether there is a static resource image in the container.

[0018] The comparison module is used to compare the static resource files involved in the static resource image with the static resource files in the static resource build directory for consistency if it is determined that a static resource image exists in the container and the static resource image of the target project has not changed, so as to obtain a consistency comparison result.

[0019] The first generation module is used to add the missing files, application resource files and static resource images to the application image script file template to generate an initial application image script file if the consistency comparison result is determined to be missing files.

[0020] The third acquisition module is used to add the command line for deleting the static resource files in the application resource file to the initial application image script file to obtain the final application image script file.

[0021] The second generation module is used to save the final application image script file to the application image building directory, and execute the final application image script file through the application image building command in the application image building directory to generate the application image of the target project.

[0022] In a third aspect, an embodiment of the present application provides a server, comprising: at least one processor and a memory; the memory stores computer execution instructions; the at least one processor executes the computer execution instructions stored in the memory, so that the at least one processor executes the method for generating an application image as described in the first aspect and various possible designs of the first aspect.

[0023] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, in which computer-executable instructions are stored. When a processor executes the computer-executable instructions, the method for generating an application image as described in the first aspect and various possible designs of the first aspect is implemented.

[0024] In a fifth aspect, an embodiment of the present application provides a computer program product, including a computer program. When the computer program is executed by a processor, it implements the method for generating an application image as described in the first aspect and various possible designs of the first aspect.

[0025] The application image generation method, device, server, medium and product provided in the present application obtain application resource files and basic dependent resource files from multiple resource files of the project, and obtain static resource files from the application resource files and basic dependent resource files; if there is a static resource image in the container, the static resource files involved in the static resource image are compared with the static resource files obtained from the application resource files and the basic dependent resource files for consistency; according to the consistency comparison results, the missing files are added to the application image script file template to generate an initial application image script file; and the command line for deleting the static resource files in the application resource files is added to the initial application image script file to obtain the final application image script file. The final application image script file is executed by the application image build command to generate the application image of the target project. The method of the present application improves the reusability of the image by proposing reuse of the static resource files in the original distribution package. BRIEF DESCRIPTION OF THE DRAWINGS

[0026] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.

[0027] Figure 1 A schematic diagram of an application scenario of a method for generating an application image according to an embodiment of the present application;

[0028] Figure 2 A flowchart of a method for generating an application image provided in an embodiment of the present application;

[0029] Figure 3 A schematic diagram of the structure of an application image generation device provided in an embodiment of the present application;

[0030] Figure 4 A schematic diagram of the structure of a server provided in an embodiment of the present application.

[0031] The above drawings have shown clear embodiments of the present application, which will be described in more detail later. These drawings and text descriptions are not intended to limit the scope of the present application in any way, but to illustrate the concept of the present application to those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION

[0032] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.

[0033] It should be noted that in the technical solution of this application, the collection, storage, use, processing, transmission, provision and disclosure of information such as financial data or user data involved are in compliance with the provisions of relevant laws and regulations and do not violate public order and good morals. The user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data 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 need to comply with relevant laws, regulations and standards, and provide corresponding operation entrances for users to choose to authorize or refuse. It should be noted that in the embodiments of this application, some existing solutions in the industry such as certain software, components, models, etc. may be mentioned, and they should be regarded as exemplary. Their purpose is only to illustrate the feasibility of the implementation of the technical solution of this application, but it does not mean that the applicant has or will necessarily use the solution.

[0034] In container technology, an image is a read-only file system template that contains all dependencies, codes, libraries, runtime environments, and configuration files required to run a project, and has the feature of resource reuse. Currently, the existing technology separates the original distribution package into variable resource files and immutable resource files through resource separation, and builds application images by reusing immutable resource images. However, this method of the existing technology does not propose reuse relative to the more complex and scattered static resource files in the original distribution package, which reduces the reusability of the image.

[0035] In view of the above technical problems, the present application proposes the following technical ideas: Considering that no reuse is proposed for complex and scattered static resource files, the reusability of the image is reduced. The inventor thought of judging whether there is a static resource image in the container, and then reuse the static resource image to generate an application image. Obtain the application resource files and basic dependent resource files in multiple resource files of the project, and obtain the static resource files from the application resource files and the basic dependent resource files; if there is a static resource image in the container, the static resource files involved in the static resource image are compared with the static resource files obtained from the application resource files and the basic dependent resource files for consistency; according to the consistency comparison results, the missing files are added to the application image script file template to generate the initial application image script file; and the command line for deleting the static resource files in the application resource file is added to the initial application image script file to obtain the final application image script file. The final application image script file is executed by the application image build command to generate the application image of the target project. The method of the present application improves the reusability of the image by proposing reuse of more complex and scattered static resource files in the original distribution package.

[0036] Figure 1Schematic diagram of an application scenario of the method for generating an application image provided in an embodiment of the present application. Figure 1 As shown, the application scenario includes: a server 10 and an enterprise private image repository 20.

[0037] The server 10 includes a file processing service device 101, an execution service device 102 and a configuration information library 103. The file processing service device 101 obtains static resource files from the original distribution package. The execution service device 102 determines whether there is a static resource image in the container and builds an application image according to the determination result. The configuration information library 103 is set with the configuration information of the target project.

[0038] The server 10 pushes the basic dependency image, static resource image and application image to the enterprise private image repository 20 for storage.

[0039] The technical solution of the present application and how the technical solution of the present application solves the above-mentioned technical problems are described in detail below with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present application will be described below in conjunction with the accompanying drawings.

[0040] Figure 2 This is a flowchart of a method for generating an application image provided by an embodiment of the present application. The execution subject of this embodiment may be Figure 1 The server 10 in the embodiment shown may also be other devices with similar functions, and this embodiment is not particularly limited here. Figure 2 As shown, the method includes:

[0041] S201: Acquire multiple resource files from an original distribution package of a target project.

[0042] Specifically, before obtaining the multiple resource files, the method further includes using a construction tool to construct an original distribution package of the target project, and decompressing the original distribution package to obtain the multiple resource files.

[0043] In this embodiment, the configuration information library is used to record the process configurable information of the whole process to guide the operation of the entire application image generation method. Specifically, the configuration information of the target project is set to obtain the configuration information library;

[0044] Optionally, the multiple resource files include application code, configuration files, dependent libraries, etc.

[0045] S202: Obtain application resource files and basic dependent resource files from multiple resource files, and obtain static resource files from the application resource files and the basic dependent resource files.

[0046] Specifically, according to the directory structure of multiple resource files, application resource files and basic dependent resource files are obtained from multiple resource files; according to the directory structure of application resource files, static resource files are obtained from application resource files; according to the directory structure of basic dependent resource files, static resource files are obtained from basic dependent resource files.

[0047] In this embodiment, the directory structure of multiple resource files includes WEB-INF, META-INF and other resource directories. The files under WEB-INF are basic dependency files, and the rest are application resource files. The files in the static, public and resources directories under the WEB-INF / classes directory corresponding to the basic dependency files are static resource files; the files in the resources directory under the META-INF directory corresponding to the application resource files, and the files in other resource directories are static resource files.

[0048] Optionally, the configuration information library includes the names and version numbers of application resource files, basic dependency resource files, and static resource files.

[0049] S203: Save the static resource file to the static resource build directory.

[0050] In this embodiment, the static resource files are saved in the static resource construction directory, and the hash value of each static resource file is saved, including but not limited to at least one of MD5, SHA1 and SHA256. For the purpose of improving reliability, multiple hash values ​​may be included.

[0051] Optionally, the configuration repository includes a static resource build directory.

[0052] S204: Determine whether there is a static resource image in the container.

[0053] S205: If it is determined that a static resource image exists in the container and the static resource image of the target project has not changed, the static resource files involved in the static resource image are compared with the static resource files in the static resource build directory to obtain a consistency comparison result.

[0054] Optionally, the configuration information repository includes a version number of the static resource image.

[0055] In this embodiment, the static resource image in the container is generated based on the basic dependency image and the static resource files in the static resource build directory of the existing project. Therefore, the static resource files involved in the static resource image all have hash values.

[0056] Specifically, the hash value corresponding to the static resource file involved in the static resource image is compared with the hash value corresponding to the static resource file in the static resource build directory to obtain a consistency comparison result.

[0057] S206: If the consistency comparison result is determined to be that there are missing files, the missing files, application resource files, and static resource images are added to the application image script file template to generate an initial application image script file.

[0058] Optionally, the configuration information repository includes an application image script file template.

[0059] In this embodiment, the missing files are static resource files involved in the static resource image, which are missing files compared to the static resource files in the static resource build directory. The missing files are added to the image script file template to generate the initial application image script file, so as to avoid missing files in the application image in the subsequent generation of the application image.

[0060] The initial application image script file includes multiple command lines, each of which includes an instruction.

[0061] In this embodiment, the command line for setting the static resource image as the base image is generated through the instruction keyword FROM; the initial application image script file also includes command lines for setting the working directory and starting the container script, and the command line for setting the working directory is generated through the instruction keyword WORKDIR; the command line for copying the application resource file to the working directory is generated through the instruction keyword COPY, and the command line for starting the container startup script is generated through the instruction keyword ENTRYPOINT to obtain the initial application image script file.

[0062] In this embodiment, since the basic dependency image has been specified in the static resource image, after the static resource image is set as the basic image for building the application image, there is no need to specify the basic dependency image again.

[0063] S207: Add the command line for deleting the static resource file in the application resource file to the initial application image script file to obtain a final application image script file.

[0064] Specifically, a list of static resource files in the application resource file is established, and a command line for deleting the list is generated through the instruction keyword RUN, and added to the initial application image script file to obtain the final application image script file.

[0065] S208: Save the final application image script file to the application image building directory, and execute the final application image script file through the application image building command in the application image building directory to generate the application image of the target project.

[0066] In this embodiment, the application image build command searches for the application image script file in the application resource build directory. The application image script file is executed to execute the container startup script, so that the application resource file and the missing files mentioned in step S206 are compressed in the working directory to obtain the application resource package; the application resource package is moved to the container deployment directory, the container is started, and during the container deployment and operation process, the application image is generated according to the static resource image and the application resource package in the container deployment directory.

[0067] Optionally, the configuration information library includes the name of the application resource package.

[0068] From the description of the above embodiment, it can be seen that the application resource files and basic dependent resource files in the multiple resource files of the project are obtained, and the static resource files are obtained from the application resource files and the basic dependent resource files; if there is a static resource image in the container, the static resource files involved in the static resource image are compared with the static resource files obtained from the application resource files and the basic dependent resource files for consistency; according to the consistency comparison result, the missing files are added to the application image script file template to generate an initial application image script file; and the command line for deleting the static resource files in the application resource files is added to the initial application image script file to obtain the final application image script file. The final application image script file is executed by the application image build command to generate the application image of the target project. The method of the present application improves the reusability of the image by proposing reuse of the static resource files in the original distribution package.

[0069] In another embodiment of the present application, based on the above embodiment, the processing process of the non-existence of static resource images in the container is described in detail. The execution subject of this embodiment can be Figure 1 The server in the illustrated embodiment may also be other devices with similar functions, which are not particularly limited in this embodiment, and specifically include:

[0070] S301: If it is determined that there is no static resource image in the container, or if it is determined that there is a static resource image in the container but the static resource image of the target project has changed, it is determined whether there is a basic dependent image in the container.

[0071] In this embodiment, if the static resource image does not exist in the container, or the static resource image required by the target project has changed, the static resource image needs to be rebuilt. It is determined whether there is a basic dependent image required in the process of building the static resource image.

[0072] Optionally, the configuration repository includes the name and version number of the rebuilt static resource image.

[0073] S302: If it is determined that a basic dependency image exists in the container, a static resource image script file is generated according to the basic dependency image and the static resource file.

[0074] The static resource image script file contains multiple command lines, each of which contains an instruction. The command line for setting the base dependency image as the base image is generated through the instruction keyword FROM; the initial application image script file also includes a command line for setting the working directory, and the command line for setting the working directory is generated through the instruction keyword WORKDIR; the command line for copying the static resource file to the working directory is generated through the instruction keyword COPY to generate a static resource image script file.

[0075] S303: Save the static resource image script file to the static resource construction directory, and execute the static resource image script file through the static resource image construction command in the static resource construction directory to generate a static resource image.

[0076] In this embodiment, the static resource image building command will search for the static resource image script file in the static resource building directory, and generate the static resource image by executing the static resource image script file.

[0077] In summary, if there is no static resource image in the container, or the static resource image required by the target project has changed, the static resource image is rebuilt to improve flexibility. In addition, if there is a basic dependency image required to build a static resource image, the basic dependency image is reused to further improve the reusability of the image.

[0078] In another embodiment of the present application, based on the above embodiment, the processing process of the absence of a basic dependent image in the container is described in detail. The execution subject of this embodiment can be Figure 1 The server in the illustrated embodiment may also be other devices with similar functions, which are not particularly limited in this embodiment, and specifically include:

[0079] S401: If it is determined that the basic dependency image does not exist in the container, or if it is determined that the basic dependency image exists in the container but the basic dependency image of the target project has changed, a basic dependency image script file is generated according to a preset basic image and a basic dependency resource file.

[0080] In this embodiment, if the basic dependency image does not exist in the container, or the basic dependency image required by the target project has changed, the basic dependency image needs to be rebuilt. Optionally, the configuration information library includes the name and version number of the rebuilt basic dependency image.

[0081] The base dependency image script file contains multiple command lines, each of which contains an instruction. The command line that sets the preset base image as the base image is generated through the instruction keyword FROM; the initial application image script file also includes a command line for setting the working directory, and the command line for setting the working directory is generated through the instruction keyword WORKDIR; the command line that copies the base dependency resource file to the working directory is generated through the instruction keyword COPY to generate a base dependency image script file.

[0082] S402: Save the base dependency image script file to the base dependency image building directory, and execute the base dependency image script file through the base dependency image building command in the base dependency image building directory to generate a base dependency image.

[0083] In this embodiment, through the basic dependency image building command, the basic dependency image script file is searched in the basic dependency resource building directory, and the basic dependency image script file is executed to generate the basic dependency image.

[0084] Optionally, the application image, static resource image, and basic dependency image are pushed to the enterprise private image repository, and the repository address of the enterprise private image repository is set in the configuration file of the target project.

[0085] In summary, if the basic dependency image does not exist in the container, or the basic dependency image required by the target project has changed, the basic dependency image is rebuilt to improve flexibility.

[0086] In another embodiment of the present application, based on the above embodiment, the configuration information library is described in detail. The execution subject of this embodiment can be Figure 1 The server in the illustrated embodiment may also be other devices with similar functions, which are not particularly limited in this embodiment, and specifically include:

[0087] Set the configuration information of the target application to obtain the configuration information library.

[0088] Among them, the configuration information library records the configurable information and is responsible for guiding the entire process of operation, including how to perform building, compression, file extraction and execution services.

[0089] In this embodiment, the configuration information library also includes all application resource files, as well as the names and version numbers of all application resource files, all basic dependent resource files, as well as the names and version numbers of all basic dependent resource files, and all static resource files, as well as the names and version numbers of all static resource files.

[0090] Optionally, the configuration repository also specifies the build content, including the base dependency image, static resource image, and application image. The application image is a required build content, and the first two can choose existing image dependencies. Since the static resource image depends on the base dependency image, the base dependency image can be omitted after specifying the static resource image dependency.

[0091] In this embodiment, the basic image used when building the basic dependent image, that is, the preset basic image mentioned in the above embodiment, needs to be configured in the configuration information library. Optionally, the preset basic image can be set to a TOMCAT basic image.

[0092] In summary, by setting up a configuration information library, on the one hand, it is possible to avoid management confusion and errors caused by decentralized storage of configuration information; on the other hand, the configuration information library guides the entire process and, as part of the automation process, can avoid human configuration errors.

[0093] Figure 3 This is a schematic diagram of the structure of the device for generating an application image provided in an embodiment of the present application. Figure 3 As shown, the device for generating the application image includes: a first acquisition module 301, a second acquisition module 302, a storage module 303, a judgment module 304, a comparison module 305, a first generation module 306, a third acquisition module 307 and a second generation module 308.

[0094] The first acquisition module 301 is used to acquire multiple resource files from the original distribution package of the target project.

[0095] The second acquisition module 302 is used to acquire application resource files and basic dependent resource files from multiple resource files, and acquire static resource files from the application resource files and basic dependent resource files.

[0096] The saving module 303 is used to save the static resource file to the static resource construction directory.

[0097] The determination module 304 is used to determine whether there is a static resource image in the container.

[0098] The comparison module 305 is used to compare the static resource files involved in the static resource image with the static resource files in the static resource build directory for consistency if it is determined that there is a static resource image in the container and the static resource image of the target project has not changed, so as to obtain a consistency comparison result.

[0099] The first generating module 306 is used to add the missing files, application resource files and static resource images to the application image script file template to generate an initial application image script file if the consistency comparison result is that there are missing files.

[0100] The third acquisition module 307 is used to add the command line for deleting the static resource files in the application resource file to the initial application image script file to obtain the final application image script file.

[0101] The second generation module 308 is used to save the final application image script file to the application image construction directory, and execute the final application image script file through the application image construction command in the application image construction directory to generate the application image of the target project.

[0102] The device provided in this embodiment can be used to execute the technical solution of the above method embodiment. Its implementation principle and technical effect are similar, and this embodiment will not be repeated here.

[0103] In one possible design, the comparison module 305 is specifically used to compare the hash value corresponding to the static resource file involved in the static resource image with the hash value corresponding to the static resource file in the static resource build directory to obtain a consistency comparison result.

[0104] In one possible design, the second acquisition module 302 is specifically used to: acquire application resource files and basic dependent resource files from multiple resource files according to the directory structure of multiple resource files; acquire static resource files from application resource files according to the directory structure of application resource files; acquire static resource files from basic dependent resource files according to the directory structure of basic dependent resource files.

[0105] In one possible design, the device for generating an application image also includes: a third generation module, which is used to determine whether there is a basic dependency image in the container if it is determined that there is no static resource image in the container, or if it is determined that there is a static resource image in the container but the static resource image of the target project has changed; if it is determined that there is a basic dependency image in the container, a static resource image script file is generated according to the basic dependency image and the static resource file; the static resource image script file is saved in a static resource build directory, and in the static resource build directory, the static resource image script file is executed by a static resource image build command to generate a static resource image.

[0106] In one possible design, the device for generating an application image further includes: a fourth generation module, which is used to generate a base dependency image script file according to a preset base image and a base dependency resource file if it is determined that the base dependency image does not exist in the container, or if it is determined that the base dependency image exists in the container but the base dependency image of the target project has changed; save the base dependency image script file to a base dependency image build directory, and execute the base dependency image script file through a base dependency image build command in the base dependency image build directory to generate a base dependency image.

[0107] In one possible design, the application image generation device also includes: a push module, which is used to push the application image, static resource image and basic dependency image to the enterprise private image repository, and set the repository address of the enterprise private image repository in the configuration file of the target project.

[0108] It should be noted that it should be understood that the division of the various modules of the above device is only a division of logical functions. In actual implementation, they can be fully or partially integrated into one physical entity, or they can be physically separated. And these modules can all be implemented in the form of software called by processing elements; they can also be all implemented in the form of hardware; some modules can also be implemented in the form of software called by processing elements, and some modules can be implemented in the form of hardware. Each module can be a separately established processing element, or it can be integrated in a chip of the above device. In addition, it can also be stored in the memory of the above device in the form of program code, and called and executed by a processing element of the above device. The functions of each module. In addition, all or part of these modules can be integrated together, or they can be implemented independently. The processing element here can be an integrated circuit with signal processing capabilities. In the implementation process, each step of the above method or each module above can be completed by an integrated logic circuit of hardware in the processor element or instructions in the form of software.

[0109] Figure 4 This is a schematic diagram of the structure of the server provided in the embodiment of the present application. Figure 4 As shown, the server may include: a transceiver 401 , a processor 402 , and a memory 403 .

[0110] The processor 402 executes the computer execution instructions stored in the memory, so that the processor 402 executes the scheme in the above embodiment. The processor 402 can be a general-purpose processor, including a central processing unit CPU, a network processor (network processor, NP), etc.; it can also be a digital signal processor DSP, an application-specific integrated circuit ASIC, a field programmable gate array FPGA or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components.

[0111] The memory 403 is connected to the processor 402 via a system bus and completes communication between them. The memory 403 is used to store computer program instructions.

[0112] The system bus can be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus, etc. The system bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus. The transceiver is used to realize the communication between the database access device and other computers (such as clients, read-write libraries, and read-only libraries). The memory may include random access memory (RAM) and may also include non-volatile memory.

[0113] The embodiment of the present application also provides a chip for running instructions, which is used to execute the technical solution of the method for generating an application image in the above embodiment.

[0114] The embodiment of the present application further provides a computer-readable storage medium, in which computer-executable instructions are stored. When the computer-executable instructions are executed by a processor, the technical solution of the method for generating an application image as in the above embodiment is implemented.

[0115] An embodiment of the present application also provides a computer program product, which includes a computer program stored in a computer-readable storage medium. At least one processor can read the computer program from the computer-readable storage medium. When the at least one processor executes the computer program, the technical solution of the method for generating an application image in the above embodiment can be implemented.

[0116] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic, for example, the division of modules is only a logical function division, and there may be other division methods in actual implementation, such as multiple modules can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or modules, which can be electrical, mechanical or other forms.

[0117] The modules described as separate components may or may not be physically separated, and the components shown as modules may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the modules may be selected according to actual needs to implement the solution of this embodiment.

[0118] In addition, each functional module in each embodiment of the present application can be integrated into one processing unit, or each module can exist physically separately, or two or more modules can be integrated into one unit. The above-mentioned module-composed unit can be implemented in the form of hardware or in the form of hardware plus software functional units.

[0119] The above-mentioned integrated module implemented in the form of a software function module can be stored in a computer-readable storage medium. The above-mentioned software function module is stored in a storage medium, including a number of instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) or a processor to perform some steps of the methods of various embodiments of the present application.

[0120] It should be understood that the processor may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), etc. A general-purpose processor may be a microprocessor or any conventional processor. The steps of the method disclosed in the invention may be directly implemented as being executed by a hardware processor, or may be implemented by a combination of hardware and software modules in the processor.

[0121] The memory may include a high-speed RAM memory, and may also include a non-volatile storage NVM, such as at least one disk memory, and may also be a USB flash drive, a mobile hard disk, a read-only memory, a magnetic disk or an optical disk, etc.

[0122] The bus may be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, the bus in the drawings of the present application is not limited to only one bus or one type of bus.

[0123] The above storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk. The storage medium can be any available medium that can be accessed by a general or special purpose computer.

[0124] An exemplary storage medium is coupled to a processor so that the processor can read information from the storage medium and write information to the storage medium. Of course, the storage medium can also be a component of the processor. The processor and the storage medium can be located in an application specific integrated circuit (ASIC). Of course, the processor and the storage medium can also exist as discrete components in an electronic control unit or a main control device.

[0125] Those skilled in the art can understand that all or part of the steps of implementing the above-mentioned method embodiments can be completed by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When the program is executed, the steps of the above-mentioned method embodiments are executed; and the aforementioned storage medium includes: ROM, RAM, disk or optical disk and other media that can store program codes.

[0126] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present application.

Claims

1. A method for generating an application image, characterized in that: Applicable to servers, including: Get multiple resource files from the original distribution package of the target project; Acquire an application resource file and a basic dependent resource file from the multiple resource files, and acquire a static resource file from the application resource file and the basic dependent resource file; Save the static resource file to the static resource construction directory; Determine whether there is a static resource image in the container; If it is determined that the static resource image exists in the container and the static resource image of the target project has not changed, the static resource files involved in the static resource image are compared with the static resource files in the static resource build directory to obtain a consistency comparison result; If it is determined that the consistency comparison result is that there is a missing file, the missing file, the application resource file and the static resource image are added to the application image script file template to generate an initial application image script file; Adding a command line for deleting the static resource file in the application resource file to the initial application image script file to obtain a final application image script file; The final application image script file is saved in an application image building directory, and the final application image script file is executed by an application image building command in the application image building directory to generate an application image of the target project.

2. The method according to claim 1, characterized in that The static resource files involved in the static resource image are compared with the static resource files in the static resource build directory for consistency, so as to obtain a consistency comparison result, including: The hash value corresponding to the static resource file involved in the static resource image is compared with the hash value corresponding to the static resource file in the static resource build directory to obtain a consistency comparison result.

3. The method according to claim 1, characterized in that The obtaining of the application resource file and the basic dependent resource file from the multiple resource files, and obtaining of the static resource file from the application resource file and the basic dependent resource file includes: According to the directory structure of the multiple resource files, obtaining the application resource file and the basic dependent resource file from the multiple resource files; According to the directory structure of the application resource file, obtaining the static resource file from the application resource file; According to the directory structure of the basic dependent resource file, the static resource file is obtained from the basic dependent resource file.

4. The method according to claim 1, characterized in that: After determining whether there is a static resource image in the container, the method further includes: If it is determined that the static resource image does not exist in the container, or if it is determined that the static resource image exists in the container but the static resource image of the target project has changed, then determining whether there is a basic dependent image in the container; If it is determined that the basic dependency image exists in the container, a static resource image script file is generated according to the basic dependency image and the static resource file; The static resource image script file is saved in the static resource construction directory, and in the static resource construction directory, the static resource image script file is executed by a static resource image construction command to generate the static resource image.

5. The method according to claim 4, characterized in that After determining whether the container contains a basic dependent image, the method further includes: If it is determined that the basic dependency image does not exist in the container, or if it is determined that the basic dependency image exists in the container but the basic dependency image of the target project has changed, a basic dependency image script file is generated according to the preset basic image and the basic dependency resource file; The base dependency image script file is saved in the base dependency image building directory, and in the base dependency image building directory, the base dependency image script file is executed by a base dependency image building command to generate the base dependency image.

6. The method according to claim 5, characterized in that Also includes: The application image, the static resource image and the basic dependency image are pushed to the enterprise private image warehouse, and the warehouse address of the enterprise private image warehouse is set in the configuration file of the target project.

7. A device for generating an application image, characterized in that: Applicable to servers, including: A first acquisition module is used to acquire multiple resource files from an original distribution package of a target project; A second acquisition module is used to acquire application resource files and basic dependent resource files from the multiple resource files, and acquire static resource files from the application resource files and the basic dependent resource files; A saving module, used to save the static resource file to a static resource construction directory; A judgment module is used to judge whether there is a static resource image in the container; A comparison module, for, if it is determined that the static resource image exists in the container and the static resource image of the target project has not changed, performing consistency comparison between the static resource files involved in the static resource image and the static resource files under the static resource build directory to obtain a consistency comparison result; A first generating module is used for adding the missing file, the application resource file and the static resource image to the application image script file template to generate an initial application image script file if it is determined that the consistency comparison result is that there is a missing file; A third acquisition module, used for adding a command line for deleting the static resource file in the application resource file to the initial application image script file to obtain a final application image script file; The second generation module is used to save the final application image script file to the application image construction directory, and execute the final application image script file through the application image construction command in the application image construction directory to generate the application image of the target project.

8. A server, characterized in that: include: A processor, and a memory communicatively connected to the processor; The memory stores computer-executable instructions; The processor executes the computer-executable instructions stored in the memory to implement the method for generating an application image according to any one of claims 1 to 6.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, and when the computer-executable instructions are executed by a processor, they are used to implement the method for generating an application image according to any one of claims 1 to 6.

10. A computer program product, characterized in that The invention comprises a computer program, which, when executed by a processor, implements the method for generating an application image according to any one of claims 1 to 6.