A front-end project deployment optimization method and system

By optimizing Dockerfile files and build configuration scripts, the problem of excessive and slow deployment of mirror packages caused by front-end project deployment in docker containers is solved, and the streamlining of mirror packages and the deployment speed is improved.

CN118626111BActive Publication Date: 2024-11-05SHANDONG FUTURE NETWORK RES INST (PURPLE MOUNTAIN LAB IND INTERNET INNOVATION APPL BASE)
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202411102846.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-08-13
Publication Date
2024-11-05
Estimated Expiration
2044-08-13

AI Technical Summary

Technical Problem

Traditional front-end project deployment based on docker containers requires the construction of the complete Vue front-end project into the image package, resulting in a huge image package, occupying server disk space and memory, and the deployment process is slow.

Method used

By optimizing the processing of Dockerfile files, generate package.json configuration files, analyze whether the front-end project source code exists in the docker container, update the source code in the container, install the dependency package using NPM mirroring service, and optimize resource through pre-configured build configuration scripts. Compress, distribution and code segmentation to reduce unnecessary files and dependencies.

Benefits of technology

Reduce the image packet size by more than 90%, reduce deployment time, improve access speed, and reduce network resource usage.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118626111B_ABST
    Figure CN118626111B_ABST
Patent Text Reader

Abstract

The present invention relates to the field of computer technology, and discloses a front-end project deployment optimization method and system, which is applied to the front-end project deployment based on a docker container, and the method comprises: generating a package.json configuration file according to a mirror package of a front-end project file; analyzing the docker container to determine whether there is a front-end project source code in the docker container; updating the front-end project source code based on the package.json configuration file according to the determination result to obtain an updated docker container; based on the updated docker container, using the NPM mirror service to scan the front-end project source code of the docker container to install the NPM dependent package. The present invention reduces space occupation, speeds up deployment progress, and improves the access speed of users after deployment.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a front-end project deployment optimization method and system. Background Art

[0002] At present, Docker containers are not only widely used in microservice architecture, continuous integration / continuous deployment (CI / CD), cloud-native applications, but also have a great impact on the development of the front-end development field. Through Docker containers, development teams can use Docker containers to build and manage front-end development environments, including tools and dependencies such as Node.js and Vue CLI. By running the development environment in a Docker container, team members can be ensured to have a consistent development environment on different development machines, avoiding the problem of "it works on my machine". By integrating Docker in the CI / CD pipeline, Vue projects can be packaged into Docker images, and applications can be automatically built, tested, and deployed through continuous integration tools (such as Jenkins, GitLab CI, etc.). This ensures the consistency of applications in different environments and enables fast and reliable deployment. By containerizing front-end services, independent deployment and expansion of front-end services can be achieved, while decoupling from other microservices.

[0003] Although the docker container has given the front-end more possibilities and broader development prospects, in the traditional front-end project deployment based on the docker container, the complete Vue front-end project needs to be built into the image package, which results in a huge image package, excessive server disk space and memory occupation, and a slow deployment process. Therefore, the traditional front-end project deployment based on the docker container only does a lot of work in use, but lacks optimization for deployment. Summary of the invention

[0004] The embodiments of the present invention provide a front-end project deployment optimization method and system to solve the above-mentioned technical problems in the prior art.

[0005] In order to have a basic understanding of some aspects of the disclosed embodiments, a brief summary is given below. This summary is not a general review, nor is it intended to identify key / important components or to describe the scope of protection of these embodiments. Its only purpose is to present some concepts in a simple form as a prelude to the detailed description that follows.

[0006] According to a first aspect of an embodiment of the present invention, a front-end project deployment optimization method is provided, which is applied to front-end project deployment based on Docker containers.

[0007] In one embodiment, the front-end project deployment optimization method includes:

[0008] When deploying a front-end project based on a docker container, the installation of NPM dependency packages in the Dockerfile file is optimized; and when deploying a front-end project based on a docker container, the installation of NPM dependency packages in the Dockerfile file is optimized including:

[0009] Generate the package.json configuration file based on the mirror package of the front-end project file;

[0010] Analyze the docker container to determine whether there is a front-end project source code in the docker container;

[0011] According to the judgment result, the front-end project source code is updated based on the package.json configuration file to obtain an updated Docker container;

[0012] Based on the updated Docker container, use the NPM mirror service to scan the front-end project source code of the Docker container to install the NPM dependency package.

[0013] In one embodiment, the front-end project source code is updated based on the package.json configuration file, and the updated docker container includes:

[0014] If the result of the judgment is that the front-end project source code does not exist in the docker container, download the front-end project source code from the package.json configuration file to the docker container to obtain an updated docker container;

[0015] If the result of the judgment is that the docker container contains the front-end project source code, obtain the version number of the front-end project source code in the docker container, and obtain the current version number of the front-end project source code from the package.json configuration file;

[0016] The front-end project source code version number in the docker container is compared with the current version number of the front-end project source code in the package.json configuration file. If the comparison result is inconsistent, the front-end project source code in the package.json configuration file is downloaded to the docker container and overwrites the original front-end project source code in the docker container to obtain an updated docker container.

[0017] In one embodiment, the NPM image service is a Taobao NPM image service.

[0018] In one embodiment, the front-end project deployment optimization method also includes: when the front-end project is deployed based on the docker container, the docker image is built using the build configuration script of the pre-configured Dockerfile file; wherein the execution operations of the pre-configured build configuration script include resource optimization operations, image compression operations, resource distribution operations, code compression operations, and code splitting operations.

[0019] In one embodiment, the optimize resource operation is used to remove unused third-party libraries, plug-ins, dependencies, styles, and files in the project to reduce the project size; the compress image operation is used to reduce the image file size using image compression tools; the resource distribution operation is used to actively distribute static resources to multiple CDN hosting to speed up access; the code compression operation is used to configure Vue CLI options to optimize code building; the code splitting operation is used to use the code splitting function of Webpack to split the code into multiple small blocks and load them on demand.

[0020] According to a second aspect of an embodiment of the present invention, a front-end project deployment optimization system is provided, which is applied to front-end project deployment based on docker containers.

[0021] In one embodiment, the front-end project deployment optimization system includes:

[0022] NPM dependency package installation optimization module, which is used to optimize the installation of NPM dependency packages in Dockerfile files when deploying front-end projects based on Docker containers;

[0023] And the NPM dependency package installation optimization module includes:

[0024] The file configuration module is used to generate the package.json configuration file based on the mirror package of the front-end project file;

[0025] The container analysis module is used to analyze the Docker container and determine whether there is a front-end project source code in the Docker container;

[0026] A container update module is used to update the source code of the front-end project based on the package.json configuration file according to the judgment result to obtain an updated docker container;

[0027] The package installation module is used to install NPM dependent packages based on the updated Docker container by using the NPM mirror service to scan the front-end project source code of the Docker container.

[0028] In one embodiment, when the container update module updates the source code of the front-end project based on the package.json configuration file according to the judgment result and obtains the updated docker container,

[0029] If the result of the judgment is that the front-end project source code does not exist in the docker container, download the front-end project source code from the package.json configuration file to the docker container to obtain an updated docker container;

[0030] If the result of the judgment is that the docker container contains the front-end project source code, obtain the version number of the front-end project source code in the docker container, and obtain the current version number of the front-end project source code from the package.json configuration file;

[0031] The front-end project source code version number in the docker container is compared with the current version number of the front-end project source code in the package.json configuration file. If the comparison result is inconsistent, the front-end project source code in the package.json configuration file is downloaded to the docker container and overwrites the original front-end project source code in the docker container to obtain an updated docker container.

[0032] In one embodiment, the NPM image service is a Taobao NPM image service.

[0033] In one embodiment, the front-end project deployment optimization system further includes:

[0034] The build configuration optimization module is used to build a docker image using the build configuration script of the pre-configured Dockerfile file when deploying a front-end project based on a docker container; wherein the execution operations of the pre-configured build configuration script include resource optimization operations, image compression operations, resource distribution operations, code compression operations, and code splitting operations.

[0035] In one embodiment, the optimize resource operation is used to remove unused third-party libraries, plug-ins, dependencies, styles, and files in the project to reduce the project size; the compress image operation is used to reduce the image file size using image compression tools; the resource distribution operation is used to actively distribute static resources to multiple CDN hosting to speed up access; the code compression operation is used to configure Vue CLI options to optimize code building; the code splitting operation is used to use the code splitting function of Webpack to split the code into multiple small blocks and load them on demand.

[0036] The technical solution provided by the embodiment of the present invention may have the following beneficial effects:

[0037] The present invention simplifies the image package through the package.json configuration file, and the size is directly reduced from tens of megabytes or hundreds of megabytes to a few bytes, and the space occupation is directly reduced by more than 90%, thereby solving the problem that the image package occupies too much server disk space.

[0038] In addition, the Docker container and package.json configuration file only include the files required for runtime, reducing unnecessary files and dependencies. Through the build configuration optimization process, the deployment progress is accelerated on the basis of the original reduction in space occupancy, the access speed of users after deployment is improved, and the occupation of network resources is reduced in disguise.

[0039] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the invention. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0041] Figure 1 It is a flowchart of a front-end project deployment optimization method according to an exemplary embodiment;

[0042] Figure 2 is a structural block diagram showing a front-end project deployment optimization system according to an exemplary embodiment;

[0043] Figure 3 The figure is a schematic diagram showing the structure of a computer device according to an exemplary embodiment. DETAILED DESCRIPTION

[0044] The terms "longitudinal", "lateral", "upper", "lower", "front", "back", "left", "right", "vertical", "horizontal", "top", "bottom", "inside", "outside", etc. in this document indicate the orientation or position relationship based on the orientation or position relationship shown in the drawings, and are only for the convenience of describing this document and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, be constructed and operate in a specific orientation, and therefore cannot be understood as a limitation on the present invention. In the description of this document, unless otherwise specified and limited, the terms "installed", "connected", and "connected" should be understood in a broad sense, for example, it can be a mechanical connection or an electrical connection, it can also be the internal communication of two elements, it can be a direct connection, or it can be an indirect connection through an intermediate medium. For ordinary technicians in this field, the specific meanings of the above terms can be understood according to specific circumstances.

[0045] As used herein, the term "plurality" means two or more than two, unless otherwise specified.

[0046] In this document, the character " / " indicates that the preceding and following objects are in an "or" relationship. For example, A / B means: A or B.

[0047] In this article, the term "and / or" is a description of the association relationship between objects, indicating that three relationships may exist. For example, A and / or B means: A or B, or, A and B.

[0048] It should be understood that, although the various steps in the flow chart are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence in the order indicated by the arrows. Unless there is a clear description in this article, there is no strict order restriction on the execution of these steps, and these steps can be executed in other orders. Moreover, at least a part of the steps in the figure can include multiple sub-steps or multiple stages, and these sub-steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these sub-steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the sub-steps or stages of other steps.

[0049] Each module in the device or system of the present application can be implemented in whole or in part by software, hardware, or a combination thereof. The above modules can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute operations corresponding to the above modules.

[0050] In the absence of conflict, the embodiments of the present invention and the features of the embodiments may be combined with each other.

[0051] Figure 1 An embodiment of a front-end project deployment optimization method of the present invention is shown, which is applied to front-end project deployment based on docker containers.

[0052] In this optional embodiment, the front-end project deployment optimization method includes:

[0053] When deploying a front-end project based on a docker container, the installation of NPM dependency packages in the Dockerfile file is optimized; and when deploying a front-end project based on a docker container, the installation of NPM dependency packages in the Dockerfile file is optimized including:

[0054] Step S101, generating a package.json configuration file according to the mirror package of the front-end project file;

[0055] Step S103, analyzing the docker container to determine whether there is a front-end project source code in the docker container;

[0056] Step S105, according to the judgment result, update the front-end project source code based on the package.json configuration file to obtain an updated docker container;

[0057] Step S107: Based on the updated docker container, use the NPM image service to scan the front-end project source code of the docker container to install the NPM dependency package.

[0058] Figure 2 An embodiment of a front-end project deployment optimization system of the present invention is shown, which is applied to front-end project deployment based on docker containers.

[0059] In this optional embodiment, the front-end project deployment optimization system includes:

[0060] NPM dependency package installation optimization module, which is used to optimize the installation of NPM dependency packages in Dockerfile files when deploying front-end projects based on Docker containers;

[0061] And the NPM dependency package installation optimization module includes:

[0062] The file configuration module 201 is used to generate a package.json configuration file according to the mirror package of the front-end project file;

[0063] The container analysis module 203 is used to analyze the docker container and determine whether there is a front-end project source code in the docker container;

[0064] The container update module 205 is used to update the source code of the front-end project based on the package.json configuration file according to the judgment result to obtain an updated docker container;

[0065] The package installation module 207 is used to install NPM dependent packages based on the updated docker container by using the NPM mirror service to scan the front-end project source code of the docker container.

[0066] In the above optional embodiment, when the front-end project source code is updated based on the package.json configuration file to obtain an updated docker container, the following aspects may be included, specifically: when the judgment result is that the docker container does not have the front-end project source code, the front-end project source code is downloaded from the package.json configuration file to the docker container to obtain an updated docker container; when the judgment result is that the docker container has the front-end project source code, the front-end project source code version number in the docker container is obtained, and the current version number of the front-end project source code is obtained from the package.json configuration file; the front-end project source code version number in the docker container is compared with the current version number of the front-end project source code in the package.json configuration file. If the comparison result is inconsistent, the front-end project source code in the package.json configuration file is downloaded to the docker container, and the original front-end project source code in the docker container is overwritten to obtain an updated docker container.

[0067] In the above optional embodiment, the NPM mirror service is the Taobao NPM mirror service.

[0068] In addition, in the above optional embodiments, in order to better optimize the deployment, when the front-end project is deployed based on the docker container, the docker image can be built using the build configuration script of the pre-configured Dockerfile file; wherein the execution operations of the pre-configured build configuration script include resource optimization operations, image compression operations, resource distribution operations, code compression operations, and code splitting operations.

[0069] Correspondingly, the system includes a build configuration optimization module, which is used to build a docker image using a build configuration script of a pre-configured Dockerfile file when deploying a front-end project based on a docker container; wherein the execution operations of the pre-configured build configuration script include resource optimization operations, image compression operations, resource distribution operations, code compression operations, and code splitting operations.

[0070] Among them, the optimization resource operation is used to remove unused third-party libraries, plug-ins, dependencies, styles and files in the project to reduce the project size; the compression image operation is used to reduce the image file size using image compression tools; the resource distribution operation is used to actively distribute static resources to multiple CDN hosting to speed up access; the code compression operation is used to configure Vue CLI options to optimize code construction; the code splitting operation is used to use the code splitting function of Webpack to split the code into multiple small blocks and load them on demand.

[0071] In order to facilitate the understanding of the above technical scheme of the present invention, the above technical scheme of the present invention is further explained from the perspective of traditional steps of deploying a Vue front-end project in a docker container and the perspective of improvement.

[0072] First, let’s introduce the traditional steps of deploying Vue front-end projects in Docker containers:

[0073] 1. Create a Dockerfile file in the project root directory to define the steps for building the Docker image. The execution steps of the code in the Dockerfile file are as follows: specify the base image (such as Node.js), set the working directory, copy all front-end project files to the working directory, use npm install to install the npm packages that the front-end project depends on, use npmrun build to build the front-end project deployment package, copy the front-end project deployment package to the default static file directory of nginx, and start nginx.

[0074] 2. Execute the Docker command docker build -t vue-app to build a Docker image. Docker build is a built-in command of Docker, which means to build a Docker image. -t vue-app means that a Docker image named vue-app will be built.

[0075] 3. Execute the Docker command docker run -d -p 8080:80 --name vue-container vue-app to run the built Docker image as a Docker container. Docker run is a built-in command of Docker, which means running the Docker image. The -d parameter means running the container in the background. -p 8080:80 means mapping the host port 8080 to the container port 80 so that the front-end project can be accessed through the browser. --name vue-container means that the name of the specified container is vue-container, and vue-app is the name of the image built in the previous step.

[0076] 4. Enter the host machine's IP address and the mapped port number in the browser to access the Vue front-end project deployed in the Docker container.

[0077] The original intention of the optimization scheme design of the present invention is to solve the problem that in the 2nd and 3rd steps of the traditional deployment, the complete Vue front-end project needs to be built into the image package, which leads to a large image package, excessive use of server disk space and memory, and a slow deployment process.

[0078] In view of the above traditional deployment problems, the present invention simplifies the mirror package directory that originally required a complete front-end project file into only the package.json configuration file, reducing the size from tens or hundreds of megabytes to a few bytes, directly reducing the space occupied by more than 90%. This perfectly solves the problem of excessive server disk space occupied by the mirror package.

[0079] In addition, the present invention relies on the node environment in the docker container to run, and determines whether the front-end project source code already exists in the current container. If not, the front-end project source code download operation is executed, and the front-end project source code of the remote code warehouse is downloaded to the current container by reading the source code warehouse configuration in package.json. If there is a project file in the current container, the front-end project source code update will be entered, and whether to update the front-end project source code will be determined by the version number. Similarly, the current version version is obtained by reading the package.json information, and then by comparing the remote warehouse version number, if it is found to be consistent, the code will not be updated. If the remote version number is ahead, the source code update will be executed until the code is updated, and the subsequent steps will continue. The script program is universal and can be used directly without modification. Only the project configuration file of package.json needs to be modified.

[0080] In addition, using Taobao mirror (Taobao mirror address is in China and Taobao company has optimized its network) as the default installation address of npm package greatly improves the installation speed of npm package. No longer blindly install all npm packages in the package.json configuration file, by scanning and summarizing the npm packages that are actually used, you can effectively reduce the server space occupied and speed up the mirror package construction speed. Get the npm packages that need to be installed by the front-end project by reading the configuration of package.json, scan the source code content, analyze which npm packages are used, the frequency of use, and which files use the npm packages, and finally summarize the npm packages that really need to be installed / updated. Then compare whether there is an npm package in the current docker environment, and whether the existing npm package is consistent with the configuration to complete the final npm package installation / update. If there is a consistent npm package, skip the installation of this npm package and continue to compare the next npm package. In this step, we bid farewell to the traditional full installation of npm packages and instead filter out the npm packages that are actually used. This not only reduces the server traffic transmission, but also reduces the server space occupancy. It is faster than the traditional install and greatly shortens the time required for install. The generation speed of the docker image package is naturally accelerated.

[0081] In addition, intelligent build configuration is also applied to the Vue front-end project packaging step. The build configuration includes: Optimize resources: remove unused third-party libraries, plug-ins, dependencies, styles, files, etc. in the project to reduce the project size; compress images: use image compression tools to reduce the size of image files; resource distribution: actively distribute static resources to multiple CDN hosting to speed up access; code compression: configure Vue CLI options to optimize code construction, such as using vue-cli-plugin-terser to compress JavaScript code, and using vue-cli-plugin-purge to remove unused CSS; code splitting: use Webpack's code splitting function to split the code into multiple small blocks and load them on demand.

[0082] After assisting the project to complete packaging, the front-end project has generated a front-end website deployment package for production environment deployment. Move this folder to the html directory of nginx, wait for the nginx configuration to be updated and the service to be restarted, and the docker environment deployment of the vue front-end project is completed.

[0083] Figure 3 An embodiment of a computer device of the present invention is shown, which may be a server, and includes a processor, a memory and a network interface connected via a system bus. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store static information and dynamic information data. The network interface of the computer device is used to communicate with an external terminal via a network connection. When the computer program is executed by the processor, the steps in the above method embodiment are implemented.

[0084] Those skilled in the art will understand that Figure 3 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present invention, and does not constitute a limitation on the computer device to which the solution of the present invention is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0085] In addition, the present invention also provides a computer device, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above method embodiment when executing the computer program.

[0086] In addition, the present invention further provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the steps in the above method embodiment are implemented.

[0087] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided by the present invention can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory or optical memory, etc. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM).

[0088] The present invention is not limited to the structures which have been described above and shown in the drawings, and various modifications and changes may be made without departing from the scope thereof. The scope of the present invention is limited only by the appended claims.

Claims

1. A front-end project deployment optimization method, applied to front-end project deployment based on docker container, characterized in that: include: When deploying front-end projects based on Docker containers, optimize the installation of NPM dependency packages in Dockerfile files; In addition, when deploying a front-end project based on a Docker container, the optimization of installing NPM dependency packages in the Dockerfile file includes: Generate the package.json configuration file based on the mirror package of the front-end project file; Analyze the docker container to determine whether there is a front-end project source code in the docker container; According to the judgment result, the front-end project source code is updated based on the package.json configuration file to obtain an updated Docker container; Based on the updated Docker container, use the NPM image service to scan the front-end project source code of the Docker container to install the NPM dependency package; When deploying a front-end project based on a docker container, a pre-configured Dockerfile build configuration script is used to build a docker image. The execution operations of the pre-configured build configuration script include resource optimization operation, image compression operation, resource distribution operation, code compression operation and code segmentation operation; The optimize resource operation is used to remove unused third-party libraries, plug-ins, dependencies, styles, and files in the project to reduce the project size; the compress image operation is used to reduce the image file size using image compression tools; the resource distribution operation is used to actively distribute static resources to multiple CDN hosting to speed up access; the code compression operation is used to configure VueCLI options to optimize code building; the code splitting operation is used to use the code splitting function of Webpack to split the code into multiple small blocks and load them on demand.

2. The front-end project deployment optimization method according to claim 1, characterized in that: According to the judgment result, the front-end project source code is updated based on the package.json configuration file, and the updated docker container includes: If the result of the judgment is that the front-end project source code does not exist in the docker container, download the front-end project source code from the package.json configuration file to the docker container to obtain an updated docker container; If the result of the judgment is that the docker container contains the front-end project source code, obtain the version number of the front-end project source code in the docker container, and obtain the current version number of the front-end project source code from the package.json configuration file; The front-end project source code version number in the docker container is compared with the current version number of the front-end project source code in the package.json configuration file. If the comparison result is inconsistent, the front-end project source code in the package.json configuration file is downloaded to the docker container and overwrites the original front-end project source code in the docker container to obtain an updated docker container.

3. The front-end project deployment optimization method according to claim 1, characterized in that: The NPM image service is the Taobao NPM image service.

4. A front-end project deployment optimization system, applied to front-end project deployment based on docker containers, characterized in that: include: NPM dependency package installation optimization module, which is used to optimize the installation of NPM dependency packages in Dockerfile files when deploying front-end projects based on Docker containers; And the NPM dependency package installation optimization module includes: The file configuration module is used to generate the package.json configuration file based on the mirror package of the front-end project file; The container analysis module is used to analyze the Docker container and determine whether there is a front-end project source code in the Docker container; A container update module is used to update the source code of the front-end project based on the package.json configuration file according to the judgment result to obtain an updated docker container; The package installation module is used to install NPM dependent packages based on the updated Docker container by using the NPM image service to scan the front-end project source code of the Docker container; The build configuration optimization module is used to build a docker image using the build configuration script of the pre-configured Dockerfile file when deploying a front-end project based on a docker container; wherein the execution operations of the pre-configured build configuration script include resource optimization operations, image compression operations, resource distribution operations, code compression operations, and code splitting operations; the resource optimization operation is used to remove unused third-party libraries, plug-ins, dependencies, styles, and files in the project to reduce the project size; the image compression operation is used to reduce the image file size using an image compression tool; the resource distribution operation is used to actively distribute static resources to multiple CDN hosting to speed up access; the code compression operation is used to configure VueCLI options to optimize code construction; the code splitting operation is used to use the code splitting function of Webpack to split the code into multiple small blocks for on-demand loading.

5. The front-end project deployment optimization system according to claim 4, characterized in that: When the container update module updates the source code of the front-end project based on the package.json configuration file according to the judgment result and obtains the updated docker container, If the result of the judgment is that the front-end project source code does not exist in the docker container, download the front-end project source code from the package.json configuration file to the docker container to obtain an updated docker container; If the result of the judgment is that the docker container contains the front-end project source code, obtain the version number of the front-end project source code in the docker container, and obtain the current version number of the front-end project source code from the package.json configuration file; The front-end project source code version number in the docker container is compared with the current version number of the front-end project source code in the package.json configuration file. If the comparison result is inconsistent, the front-end project source code in the package.json configuration file is downloaded to the docker container and overwrites the original front-end project source code in the docker container to obtain an updated docker container.

6. The front-end project deployment optimization system according to claim 5, characterized in that: The NPM image service is the Taobao NPM image service.

Citation Information

Patent Citations

  • Docker-based information system deployment and upgrade management method

    CN108021427A

  • Docker container construction method and device, equipment and storage medium

    CN110058863A

  • Front-end project implementation method and device, electronic equipment and storage medium

    CN117931219A

  • Automatic operation and maintenance method based on container and big data

    CN117971384A