Compilation method, device, equipment and storage medium

By installing preset file systems and snapshot technology in container nodes, the problems of low compilation environment acquisition efficiency and environment conflicts are solved, and container node compilation can be shared by multiple people, saving hardware resources and improving compilation efficiency.

CN112256278BActive Publication Date: 2024-10-01GUANGDONG OPPO MOBILE TELECOMMUNICATIONS CORP LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202011239292.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-11-09
Publication Date
2024-10-01
Estimated Expiration
2040-11-09

AI Technical Summary

Technical Problem

In the existing technology, when the server is used to compile source code, the data volume of the compilation environment is large and not isolated, resulting in low compilation efficiency, and each technician needs to pull the environment independently, which takes a long time, and environment conflicts may cause compilation failure. .

Method used

Install a preset file system in the container node, obtain the compilation environment through snapshot technology, and deploy the compilation environment in the container, allowing multiple technicians to share a container node for compilation, saving hardware resources, and determining the designated directory through the preset file system Obtain the compilation environment and improve acquisition efficiency.

Benefits of technology

It enables multiple technicians to share container nodes for compilation, saving hardware resources, improving compilation efficiency, avoiding environmental conflicts, and improving compilation success rate.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112256278B_ABST
    Figure CN112256278B_ABST
Patent Text Reader

Abstract

The embodiments of the present application provide a compilation method, device, equipment and storage medium. The method is applied to a container node, and the container node is installed with a preset file system. The method includes: when the compilation environment is stored in a specified directory, access the specified directory to obtain the compilation environment, and the specified directory is determined according to the preset file system; deploy the compilation environment in the target container of the container node; compile the source code file under the compilation environment deployed by the target container to obtain an executable file. The technical solution provided by the embodiment of the present application isolates the compilation environment through a container. Since a container node can deploy multiple containers, a container node can be used by multiple technicians to complete the compilation work, saving the hardware resources required for compilation. In addition, by installing a preset file system in the container node, the container can quickly obtain the compilation environment and improve the compilation efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the field of program development technology, and in particular to a compilation method, apparatus, device and storage medium. Background Art

[0002] Compilation refers to a series of processing of high-level language source files to obtain an executable file of binary code.

[0003] In the related art, a corresponding compilation environment is deployed in a server, and the server pulls source code files from a code repository and then compiles the source code files into executable files under the above compilation environment. Summary of the invention

[0004] The present application provides a compilation method, apparatus, device and storage medium. The technical solution includes:

[0005] On the one hand, an embodiment of the present application provides a compilation method, which is applied to a container node, wherein the container node is installed with a preset file system, and the method includes:

[0006] When the compilation environment is stored in a designated directory, accessing the designated directory to obtain the compilation environment, the designated directory being determined according to the preset file system;

[0007] Deploying the compilation environment in a target container of the container node;

[0008] The source code file is compiled in the compilation environment deployed by the target container to obtain an executable file.

[0009] On the other hand, an embodiment of the present application provides a compiling device, the device comprising:

[0010] An environment acquisition module, used to access a specified directory to acquire the compilation environment when the compilation environment is stored in the specified directory, wherein the specified directory is determined according to a preset file system installed in the container node;

[0011] An environment deployment module, used to deploy the compilation environment in a target container of the container node;

[0012] The compiling module is used to compile the source code file in the compiling environment deployed by the target container to obtain an executable file.

[0013] On the other hand, an embodiment of the present application provides a computer device, which includes a processor and a memory, wherein the memory stores a computer program, and the computer program is loaded and executed by the processor to implement the compilation method as described in the first aspect.

[0014] On the other hand, an embodiment of the present application provides a computer-readable storage medium, in which a computer program is stored. The computer program is loaded and executed by a processor to implement the compilation method as described in the first aspect.

[0015] In another aspect, an embodiment of the present application provides a computer program product, the computer program product or computer program includes computer instructions, the computer instructions are stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the above-mentioned compilation method.

[0016] The beneficial effects brought by the technical solution provided by the embodiment of the present application include at least:

[0017] By deploying a compilation environment in a container in a container node, and then compiling the source code file into an executable file under the compilation environment deployed in the container, since a container node can install multiple containers and each container is completely isolated, a container node can be used by multiple technicians to complete the compilation of the source code, saving the hardware resources required for source code compilation. In addition, by installing a preset file system in the container node, the container with compilation requirements can obtain the compilation environment from the specified directory determined based on the preset file system, without having to write the compilation environment completely into the container, thereby improving the efficiency of obtaining the compilation environment and thus improving the compilation efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] Figure 1 It is an architectural diagram of container technology;

[0019] Figure 2 It is a schematic diagram of the snapshot technique;

[0020] Figure 3 It is a compiled architecture diagram provided by related technologies;

[0021] Figure 4 It is another compiled architecture diagram provided by related technology;

[0022] Figure 5 It is a schematic diagram of an implementation environment provided by an embodiment of the present application;

[0023] Figure 6 is a flowchart of a compilation method provided by an embodiment of the present application;

[0024] Figure 7 yes Figure 6 An architectural diagram of the compilation involved in the embodiment;

[0025] Figure 8 This is a diagram of the architecture of compilation provided by an embodiment of the present application;

[0026] Fig. 9 is a structural block diagram of a compiling device provided by an embodiment of the present application;

[0027] Fig.10 It is a structural block diagram of a computer device provided by an embodiment of the present application. DETAILED DESCRIPTION

[0028] In order to make the objectives, technical solutions and advantages of the present application clearer, the implementation methods of the present application will be further described in detail below with reference to the accompanying drawings.

[0029] Container technology: A lightweight virtualization technology that allows running applications and their dependencies (such as application plug-ins) in a resource-isolated process. It is a lightweight, operating system-level virtualization technology. All necessary components required to run the application are packaged into a single image, which can be reused. When the image runs, it runs in an independent environment and does not share the host operating system's memory, CPU, or disk with other applications. This ensures that the process in the container will not affect any process outside the container.

[0030] Combined with reference Figure 1 , which shows a container isolation architecture diagram provided by an embodiment of the present application. The container isolation architecture diagram includes infrastructure 11, host operating system 12, container 13 and application.

[0031] The infrastructure 11 refers to a server or a virtual machine running a host operating system 12 .

[0032] The host operating system 12 is a computer program that manages the hardware and software resources of the infrastructure 11. Optionally, the host operating system 12 is a Linux operating system.

[0033] The container 13 is installed on the host operating system 12, and it depends on the host operating system 12. The embodiment of the present application does not limit the number of containers 13 installed in the host operating system 12, for example, one or more.

[0034] An application refers to a computer program that completes one or more specific tasks and runs in the container 13 .

[0035] BtrFS (Butter File System) file system: A file system released by Oracle with the Copy-on-Write (CoW) feature, also known as snapshot.

[0036] Snapshot: It is a record of the state of data storage at a certain moment. Figure 2 Explain how snapshot technology works.

[0037] Figure 2 Part (a) in FIG. 1 shows the structure of directory A. Directory A includes subdirectories B and E, subdirectory B includes subdirectories C and D, and subdirectory E includes subdirectory F.

[0038] Figure 2 Part (b) of FIG. 1 shows the operation on directory A through the snapshot technique. Figure 2 From part (b) of the example, we can see that directory A is not copied, but only a new index is created. .

[0039] Figure 2 Part (c) shows the modification of directory C under directory A. Figure 2 From part (c) of the above, we can see that directory C is modified to When creating an independent branch, And the subdirectory B that subdirectory C depends on is written to the disk.

[0040] In the related art, one server can only be used by one technician to complete the compilation of source code files, and the compilation requires more hardware resources.

[0041] The related art also provides a compilation method, which obtains a compilation environment through a target container in a container node, then deploys the obtained compilation environment in the target container, and then compiles the source code file under the compilation environment deployed in the target container to obtain an executable file. Figure 3 , which shows a schematic diagram of compiling in a container provided by the relevant technology. A container engine and three containers are running in a container node, and each container is deployed with a different compilation environment. The relevant technicians implement compilation in the container through the terminal 31.

[0042] The above-mentioned related technologies have the following defects: since the amount of data in the compilation environment is large, and since each technician needs to pull the compilation environment through the container, the process is time-consuming, resulting in low compilation efficiency.

[0043] The related art also provides a compilation method, which sets the storage driver of the computer device to a preset file system with a snapshot feature, and then quickly obtains the compilation environment based on the snapshot feature of the preset file system, and completes the files required for compilation, and then compiles the source file code under the above compilation environment to obtain an executable file. Figure 4 , which shows a schematic diagram of compiling based on a preset file system provided by the related technology. The computer device is installed with a preset file system with a snapshot feature, and the compilation environment is obtained through the snapshot technology. The related technicians implement the compilation based on the preset file system through the terminal 41.

[0044] The above-mentioned related technologies have the following defects: since each compilation environment is not isolated, environment conflicts may occur, which may lead to compilation failure.

[0045] Based on the defects of the above two related technologies, the embodiment of the present application provides a compilation method, which deploys a compilation environment in a container in a container node, and then compiles the source code file into an executable file under the compilation environment deployed in the container. Since a container node can install multiple containers, and each container is completely isolated, a container node can be used by multiple technicians to complete the compilation of the source code, saving the hardware resources required for source code compilation. In addition, by installing a preset file system in the container node, the container with compilation requirements can obtain the compilation environment from the specified directory determined based on the preset file system, without having to write the compilation environment completely into the container, thereby improving the efficiency of obtaining the compilation environment and thus improving the compilation efficiency.

[0046] Please refer to Figure 5 , which shows a schematic diagram of an implementation environment shown in an embodiment of the present application. The implementation environment includes at least one container node 51 and a container management node 52.

[0047] The container node 51 is deployed with at least one container 512. The embodiment of the present application does not limit the number of containers deployed by the container node 51, for example, it is determined according to the type of the compilation environment, or allocated by the container management node.

[0048] Optionally, different containers in the container node 51 are deployed with different compilation environments. Since the container can effectively isolate the compilation environment, different containers can support the compilation of source code in different compilation environments. That is, one container node 51 can support multiple technicians to complete the compilation of source code, saving the hardware resources required for source code compilation.

[0049] Optionally, a preset file system is installed in the container node 51, for example, the storage driver of the container node 51 is set to the preset file system, or the storage driver of some containers 512 in the container node 51 is set to the preset file system. The container node 51 can implement a snapshot function through the preset file system. The snapshot function is used to implement online data backup and recovery, provide another data access channel for storage users, etc. In an embodiment of the present application, the container 512 in the container node 51 accesses the compilation environment through the snapshot function, and then deploys the compilation environment inside itself. Optionally, the preset file system is a BtrFS file system.

[0050] Optionally, the container node 51 is a physical server, such as a server, a server cluster consisting of multiple servers, etc. Optionally, the container node 51 is a virtual server, such as a virtual machine.

[0051] The container management node 52 is used to manage the creation, modification and destruction of containers. In the embodiment of the present application, the container management node 52 manages the containers in the container node, so that the container node can reasonably create and destroy containers according to demand, saving processing resources. The container management node 52 can be a server, a server cluster composed of multiple servers, or a cloud computing service center.

[0052] A communication connection is established between the container node 51 and the container management node 52 via a wired or wireless network. The above-mentioned wireless network or wired network uses standard communication technology and / or protocol. The network is usually the Internet, but it can also be any other network, including but not limited to a local area network (LAN), a metropolitan area network (MAN), a wide area network (WAN), a mobile, wired or wireless network, a private network or any combination of a virtual private network). In some embodiments, technologies and / or formats including Hypertext Markup Language (HTML), Extensible Markup Language (XML), etc. are used to represent data exchanged through the network. In addition, conventional encryption technologies such as Secure Socket Layer (SSL), Transport Layer Security (TLS), Virtual Private Network (VPN), Internet Protocol Security (IPsec) can also be used to encrypt all or some links. In other embodiments, customized and / or dedicated data communication technologies can also be used to replace or supplement the above-mentioned data communication technologies.

[0053] Please refer to Figure 6 , which shows a flow chart of the compilation method shown in an embodiment of the present application. The method is applied to a container node, and the container node is installed with a preset file system. In one possible implementation, the storage driver of the container node is set to the above-mentioned preset file system. In another possible implementation, the storage driver of the target container in the container node is set to the above-mentioned preset file system. Optionally, the preset file system is a BtrFS file system.

[0054] The method includes:

[0055] Step 601: When the compilation environment is stored in a designated directory, access the designated directory to obtain the compilation environment.

[0056] The designated directory is determined according to the preset file system. For example, the designated directory is set by default according to the configuration file of the preset file system. For another example, the relevant technicians set the designated directory in the configuration file of the preset file system.

[0057] Optionally, step 601 is implemented as follows: copying the index corresponding to the compilation environment, accessing the index corresponding to the copied compilation environment, and obtaining the compilation environment. Based on the characteristics of the preset file system, the target container can obtain the compilation environment by accessing the index corresponding to the compilation environment. Since the index is copied quickly and occupies less disk space, on the one hand, the efficiency of obtaining the compilation environment can be improved, and on the other hand, the storage occupation of the container node can be reduced.

[0058] Optionally, obtaining the compilation environment further includes the following steps: when the compilation environment under the specified directory is modified, obtaining the modified content from the specified directory and storing the modified content in the target container. When part of the content of the compilation environment is modified, if the target container still obtains the compilation environment by accessing the index corresponding to the compilation environment, the content before the modification is obtained. Therefore, the target container needs to store the modified content locally to avoid errors in the compilation environment, thereby improving the success rate of compilation.

[0059] Step 602: deploy a compilation environment in a target container of a container node.

[0060] After the target container obtains the compilation environment, it deploys the compilation environment. The deployment process includes the following steps: completing the configuration of environment variables and running the specified command to make the configured environment variables take effect.

[0061] Step 603: compile the source code file in the compilation environment deployed by the target container to obtain an executable file.

[0062] The source code file is a code file written in a high-level programming language, including but not limited to JAVA, C, C++, Python, etc. An executable file refers to a binary language that can be recognized by a computer device.

[0063] Program compilation refers to the process of using a compiler to generate a target program from an original program written in a source language. It includes five stages: lexical analysis, syntax analysis, semantic checking, intermediate code generation, and code optimization.

[0064] Lexical analysis and syntax analysis are also called source program analysis, which is used to check whether there are syntax errors in the source file. Intermediate code is an internal representation of the source program, which is used to make the structure of the compiler program logically simpler and clearer. The complexity of the intermediate language is between the source program language and the machine language. There are many forms of intermediate language, the most common ones are reverse Polish notation, quadruple, ternary and tree. Code optimization refers to performing multiple equivalent transformations on the program so that more effective target code can be generated from the transformed program.

[0065] Optionally, a compiler is running in the target container, and the compiler is used to compile the source code file in a compilation environment deployed in the target container to obtain an executable file.

[0066] Optionally, before step 601, the container node needs to store the compilation environment to a designated directory first. Optionally, before step 601, the compilation method also includes: when the compilation environment does not exist in the designated directory, obtaining the code file corresponding to the compilation environment from the storage space where the code file is stored; compiling the code file corresponding to the compilation environment to obtain the compilation environment; storing the compilation environment to the designated directory. The storage space where the code file is stored can be in the container node (for example, a non-designated directory in the container node) or can be independent of the container node (for example, an external database). The container node needs to first obtain the code file corresponding to the compilation environment, and compile it into a compilation environment based on the code file corresponding to the compilation environment, and store it in the designated directory, after which other containers can quickly obtain the compilation environment from the designated directory through snapshot technology.

[0067] Combined with reference Figure 7 , which shows a schematic diagram of compilation provided by an embodiment of the present application, in which a container engine and three containers are running in a container node, and the storage driver of the container node is a preset file system. At this time, the container node supports the container to obtain the compilation environment and deploy the compilation environment through snapshot technology, and then the relevant technical personnel implement compilation based on the preset file system through terminal 71.

[0068] In summary, the technical solution provided by the embodiment of the present application deploys a compilation environment in a container in a container node, and then compiles the source code file into an executable file in the compilation environment deployed in the container. Since a container node can install multiple containers, and each container is completely isolated from each other, a container node can be used by multiple technicians to complete the compilation of the source code, saving the hardware resources required for source code compilation. In addition, by installing a preset file system in the container node, the container with compilation requirements can obtain the compilation environment from the specified directory determined based on the preset file system, without having to write the compilation environment completely into the container, thereby improving the efficiency of obtaining the compilation environment and thus improving the compilation efficiency.

[0069] Based on Figure 6 In the optional embodiment provided by the illustrated embodiment, before step 602, the compiling method further includes the following steps:

[0070] Step 701: Send a container creation request to a container management node.

[0071] The container creation request is used to request the creation of a target container. The container creation request carries the identifier of the container node. Optionally, the container node also carries its own available resources, such as storage resources, computing resources, etc.

[0072] Optionally, the container node sends a container creation request to the container management node when receiving the container creation instruction, and the relevant technician triggers the above container creation instruction when there is a compilation requirement. Optionally, the container management node sends a container creation request to the container management node after obtaining the compilation arrangement.

[0073] Correspondingly, the container management node receives the container creation request sent by the container node.

[0074] Step 702: Receive first response information corresponding to the container creation request sent by the container management node.

[0075] The container management node determines whether to allow the creation of the target container based on the available resources of the container node carried in the container creation request, and then generates a first response message based on the judgment result. If the available resources of the container node are sufficient, the target container is allowed to be created; if the available resources of the container node are insufficient, the target container is not allowed to be created.

[0076] Step 703: Create a target container according to the first response information.

[0077] If the first response message is used to indicate that creation of the target container is allowed, the container node creates the target container.

[0078] Based on Figure 5 In an optional embodiment provided by the illustrated embodiment, after step 503, the compiling method further includes the following steps:

[0079] Step 704: Send a container destruction request to the container management node.

[0080] The container destroy request is used to destroy the target container. The container destroy request carries the identifier of the container node and the identifier of the target container. After the container node completes the compilation in the target container, it requests the container management node to destroy the target container.

[0081] Correspondingly, the container management node receives the container destruction request sent by the container node.

[0082] Step 705: Receive second response information corresponding to the container destruction request sent by the container management node.

[0083] After receiving the container destruction request, the container management node returns a second response message to the container node.

[0084] Step 706: destroy the target container according to the second response information.

[0085] The container node destroys the target container according to the second response message, and releases the resources occupied by the target container.

[0086] Optionally, when multiple container nodes are managed through a container management node, the container management node also abstracts the disk into a local disk based on the network protocol, and then the above-mentioned multiple container nodes can share the disk, that is, quickly obtain the compilation environment from the shared disk, thereby saving disk space and improving the efficiency of obtaining the compilation environment.

[0087] Optionally, the controller of the container management node sets the volume as a preset file system, so that containers in multiple container platforms can access the preset file system to obtain the compilation environment. Volumes are created and managed by containers, and data is placed in a specified directory and can be mounted for use by multiple containers.

[0088] Combined with reference Figure 8 , which shows an architecture diagram involved in compilation provided by an embodiment of the present application. A container management node manages multiple container nodes, each container node is deployed with a container, and the container in the container node obtains the compilation environment image from a shared server based on a preset file system based on the snapshot technology.

[0089] In summary, the technical solution provided in the embodiment of the present application implements the management and scheduling of the container cluster through the container management node, such as creating containers, destroying containers, etc.

[0090] The following is an embodiment of the device of the present application. For parts not described in detail in the embodiment of the device, refer to the technical details disclosed in the above method embodiment.

[0091] refer to Fig. 9 , shows a block diagram of a compiling device provided by an exemplary embodiment of the present application. The compiling device is implemented as all or part of a terminal through software, hardware, or a combination of both. The compiling device includes:

[0092] The environment acquisition module 901 is used to access the specified directory to acquire the compilation environment when the compilation environment is stored in the specified directory, and the specified directory is determined according to a preset file system installed in the container node.

[0093] The environment deployment module 902 is used to deploy the compilation environment in the target container of the container node.

[0094] The compiling module 903 is used to compile the source code file in the compiling environment deployed by the target container to obtain an executable file.

[0095] In summary, the technical solution provided by the embodiment of the present application deploys a compilation environment in a container in a container node, and then compiles the source code file into an executable file in the compilation environment deployed in the container. Since a container node can install multiple containers, and each container is completely isolated from each other, a container node can be used by multiple technicians to complete the compilation of the source code, saving the hardware resources required for source code compilation. In addition, by installing a preset file system in the container node, the container with compilation requirements can obtain the compilation environment from the specified directory determined based on the preset file system, without having to write the compilation environment completely into the container, thereby improving the efficiency of obtaining the compilation environment and thus improving the compilation efficiency.

[0096] Based on Fig. 9 In the optional embodiment provided by the illustrated embodiment, the environment acquisition module 901 is used to:

[0097] Copy the index corresponding to the compilation environment;

[0098] The specified directory is accessed through the index corresponding to the copied compilation environment to obtain the compilation environment.

[0099] Based on Fig. 9 In the optional embodiment provided by the illustrated embodiment, the environment acquisition module 901 is further used for:

[0100] When the compilation environment under the designated directory is modified, obtaining the modified content from the designated directory;

[0101] The modified content is stored in the target container.

[0102] Based on Fig. 9 In an optional embodiment provided by the illustrated embodiment, the device further includes: a container creation module ( Fig. 9 not shown).

[0103] Container creation module for:

[0104] Sending a container creation request to a container management node, where the container creation request is used to create the target container;

[0105] Receiving first response information corresponding to the container creation request sent by the container management node;

[0106] The target container is created according to the first response information.

[0107] Optionally, the device further comprises: a container destruction module ( Fig. 9not shown).

[0108] Container destruction module, used to:

[0109] Sending a container destruction request to the container management node, where the container destruction request is used to destroy the target container;

[0110] Receiving second response information corresponding to the container destruction request sent by the container management node;

[0111] The target container is destroyed according to the second response information.

[0112] Based on Fig. 9 In an optional embodiment provided by the illustrated embodiment, the device further comprises: a compilation environment acquisition module ( Fig. 9 not shown).

[0113] Compile environment acquisition module, used for:

[0114] When the compilation environment does not exist in the designated directory, obtaining a code file corresponding to the compilation environment from a storage space storing code files;

[0115] Compiling the code file corresponding to the compilation environment to obtain the compilation environment;

[0116] The compilation environment is stored in the specified directory.

[0117] Fig.10 1 is a schematic diagram of the structure of a computer device provided by an embodiment of the present application. The computer device 1000 includes a central processing unit (CPU) 1001, a system memory 1004 including a random access memory (RAM) 1002 and a read-only memory (ROM) 1003, and a system bus 1005 connecting the system memory 1004 and the central processing unit 1001. The computer device 1000 also includes a basic input / output system (I / O system) 1006 for helping to transmit information between various devices in the computer, and a large-capacity storage device 1007 for storing an operating system 1013, an application program 1014 and other program modules 1015.

[0118] The basic input / output system 1006 includes a display 1008 for displaying information and an input device 1009 such as a mouse and a keyboard for user inputting information. The display 1008 and the input device 1009 are connected to the central processing unit 1001 through an input / output controller 1010 connected to the system bus 1005. The basic input / output system 1006 may also include an input / output controller 1010 for receiving and processing inputs from a plurality of other devices such as a keyboard, a mouse, or an electronic stylus. Similarly, the input / output controller 1010 also provides output to a display screen, a printer, or other types of output devices.

[0119] The mass storage device 1007 is connected to the central processing unit 1001 via a mass storage controller (not shown) connected to the system bus 1005. The mass storage device 1007 and its associated computer readable medium provide non-volatile storage for the computer device 1000. That is, the mass storage device 1007 may include a computer readable medium (not shown) such as a hard disk or a compact disc read-only memory (CD-ROM) drive.

[0120] Without loss of generality, the computer-readable medium may include computer storage media and communication media. Computer storage media include volatile and non-volatile, removable and non-removable media implemented by any method or technology for storing information such as computer-readable instructions, data structures, program modules or other data. Computer storage media include RAM, ROM, Erasable Programmable Read-Only Memory (EPROM), Electrically Erasable Programmable Read-Only Memory (EEPROM), flash memory or other solid-state storage technology, CD-ROM, Digital Versatile Disc (DVD) or other optical storage, cassettes, tapes, disk storage or other magnetic storage devices. Of course, those skilled in the art will know that the computer storage medium is not limited to the above. The above-mentioned system memory 1004 and mass storage device 1007 can be collectively referred to as memory.

[0121] According to various embodiments of the present application, the computer device 1000 can also be connected to a remote computer on a network through a network such as the Internet. That is, the computer device 1000 can be connected to the network 1012 through the network interface unit 1011 connected to the system bus 1005, or the network interface unit 1011 can be used to connect to other types of networks or remote computer systems (not shown).

[0122] Specifically in the embodiment of the present application, the computer device 1000 further includes a memory and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by one or more processors. The one or more programs include instructions for executing the above-mentioned compilation method.

[0123] In an exemplary embodiment, a computer-readable storage medium is further provided, wherein at least one instruction is stored in the computer-readable storage medium, and the at least one instruction is loaded and executed by a processor of a mobile terminal to implement the compiling method in the above method embodiment.

[0124] Optionally, the computer-readable storage medium may be a ROM, RAM, magnetic tape, floppy disk, optical data storage device, etc.

[0125] In an exemplary embodiment, a computer program product is also provided, the computer program product includes computer instructions, the computer instructions are stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the method provided in the above-mentioned one aspect or various optional implementations of one aspect.

[0126] It should be understood that the "plurality" mentioned in this article refers to two or more. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the previous and next associated objects are in an "or" relationship. The words "first", "second" and similar terms used in this article do not indicate any order, quantity or importance, but are only used to distinguish different components.

[0127] The serial numbers of the embodiments of the present application are for description only and do not represent the advantages and disadvantages of the embodiments. The above description is only an exemplary embodiment of the present application and is not intended to limit the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.

Claims

1. A compiling method, characterized in that: Applied to a container node, the container node is installed with a preset file system, the method includes: When the compilation environment is stored in a designated directory, accessing the designated directory to obtain the compilation environment, the designated directory being determined according to the preset file system; Sending a container creation request to a container management node, the container creation request is used to create a target container, the container creation request carries an identifier of the container node and available resources of the container node, the available resources are used by the container management node to determine whether to allow the creation of the target container, the container management node abstracts the disk into a local disk based on a network protocol, so that multiple container nodes share the disk, and the disk is used to store the specified directory; Receiving first response information corresponding to the container creation request sent by the container management node; Creating the target container according to the first response information; Deploying the compilation environment in the target container of the container node; The source code file is compiled in the compilation environment deployed by the target container to obtain an executable file.

2. The method according to claim 1, characterized in that The accessing the designated directory to obtain the compilation environment includes: Copy the index corresponding to the compilation environment; Access the index corresponding to the copied compilation environment to obtain the compilation environment.

3. The method according to claim 1, characterized in that The accessing the designated directory to obtain the compilation environment further includes: When the compilation environment under the designated directory is modified, obtaining the modified content from the designated directory; The modified content is stored in the target container.

4. The method according to any one of claims 1 to 3, characterized in that: After the source code file is compiled in the compilation environment deployed by the target container to obtain an executable file, the method further includes: Sending a container destruction request to the container management node, where the container destruction request is used to destroy the target container; Receiving second response information corresponding to the container destruction request sent by the container management node; The target container is destroyed according to the second response information.

5. The method according to any one of claims 1 to 3, characterized in that: Before accessing the designated directory to obtain the compilation environment, the method further includes: When the compilation environment does not exist in the designated directory, obtaining a code file corresponding to the compilation environment from a storage space storing code files; Compiling the code file corresponding to the compilation environment to obtain the compilation environment; The compilation environment is stored in the specified directory.

6. A compiling device, characterized in that: The device comprises: An environment acquisition module, used to access a specified directory to acquire the compilation environment when the compilation environment is stored in the specified directory, wherein the specified directory is determined according to a preset file system installed in the container node; A container creation module, configured to send a container creation request to a container management node, wherein the container creation request is used to create a target container, wherein the container creation request carries an identifier of the container node and available resources of the container node, wherein the available resources are used by the container management node to determine whether to allow the creation of the target container, wherein the container management node abstracts a disk into a local disk based on a network protocol so that multiple container nodes share the disk, and the disk is used to store the specified directory; receiving a first response message corresponding to the container creation request sent by the container management node; and creating the target container according to the first response message; An environment deployment module, used to deploy the compilation environment in the target container of the container node; The compiling module is used to compile the source code file in the compiling environment deployed by the target container to obtain an executable file.

7. The device according to claim 6, characterized in that The environment acquisition module is used to: Copy the index corresponding to the compilation environment; Access the index corresponding to the copied compilation environment to obtain the compilation environment.

8. The device according to claim 6, characterized in that The environment acquisition module is used to: When the compilation environment under the designated directory is modified, obtaining the modified content from the designated directory; The modified content is stored in the target container.

9. A computer device, characterized in that: The computer device comprises a processor and a memory, wherein the memory stores a computer program, and the computer program is loaded by the processor and executes the compiling method according to any one of claims 1 to 5.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and the computer program is loaded and executed by a processor to implement the compilation method according to any one of claims 1 to 5.