Disclosure of Invention
The invention provides a method, a device, equipment and a storage medium for constructing a Python project image, which are used for constructing the Python project image by adopting a multi-stage construction strategy so as to reduce the image size.
The first aspect of the invention provides a Python project image construction method, which comprises the steps of obtaining a first lightweight base image as a construction stage base image, installing a base dependent item and a construction tool in the construction stage base image, copying a dependent file in a Python project into the construction stage base image, generating a dependent layer by combining the construction tool, copying a code in the Python project into the construction stage base image, executing a construction step in the code to obtain a construction product, obtaining a second lightweight base image as an operation environment base image, copying the dependent layer and the construction product into the operation environment base image to obtain an initial image, carrying out compatibility verification on the initial image, if the initial image passes the verification, using the initial image as the Python project image, if the verification fails, obtaining a corrected and re-verified initial image, and using the corrected and re-verified initial image as the Python project.
Optionally, in a first implementation manner of the first aspect of the present invention, the obtaining the first lightweight base image as a build stage base image and installing a base dependency item and a build tool in the build stage base image includes obtaining a configuration requirement, determining a version of the first lightweight base image, the base dependency item and the build tool based on the configuration requirement, obtaining a first lightweight base image of a corresponding version from an official image library based on the determined version as a build stage base image, and installing the base dependency item and the build tool in a file system layer created by the build stage base image.
Optionally, in a second implementation manner of the first aspect of the present invention, the copying the dependent file in the Python item into the build phase base image and generating the dependent layer in conjunction with the build tool includes copying the dependent file in the Python item from a local item directory into a working directory of the build phase base image, generating a dependent installation instruction according to the dependent file, and generating the dependent layer in conjunction with the build tool based on the dependent installation instruction.
Optionally, in a third implementation manner of the first aspect of the present invention, the copying the code in the Python item to the construction phase base image and executing the construction step in the code to obtain a construction product includes copying the code in the Python item from a local item directory to a working directory of the construction phase base image, generating a plurality of shell scripts based on the construction step in the code, and executing the shell scripts in Dockerfile to obtain the construction product.
Optionally, in a fourth implementation manner of the first aspect of the present invention, the obtaining the second lightweight base image as an operating environment base image, copying the dependency layer and the build product into the operating environment base image to obtain an initial image includes obtaining a configuration requirement, determining a version of the second lightweight base image based on the configuration requirement, obtaining the second lightweight base image of a corresponding version from an official image library based on the determined version as the operating environment base image, copying the dependency layer and the build product into the operating environment base image, and deleting a cache file, a temporary file and a non-operating required file to obtain the initial image.
Optionally, in a fifth implementation manner of the first aspect of the present invention, the copying the dependency layer and the build product into the running environment base image, and deleting the cache file, the temporary file and the non-running required file to obtain the initial image includes copying the dependency layer and the build product into the running environment base image, deleting the cache file and the temporary file by using a RUN instruction in Dockerfile in combination with a shell command, calling a preset deletion script, traversing the file and the directory in the running environment base image by using the deletion script, and deleting the non-running required file to obtain the initial image.
Optionally, in a sixth implementation manner of the first aspect of the present invention, the performing compatibility verification on the initial image, if the verification passes, using the initial image as a Python item image, if the verification fails, obtaining a corrected and re-verified initial image, and using the corrected and re-verified initial image as a Python item image, where the method includes obtaining a preset compatibility verification index, where the compatibility verification index includes Python version, library compatibility and operating system compatibility, performing compatibility verification on the initial image based on the compatibility verification index, to obtain a verification result, if the verification result is verification passing, using the initial image as a Python item image, if the verification result is verification failure, obtaining a corrected and re-verified initial image, and using the corrected and re-verified initial image as a Python item image.
The invention provides a Python project image construction device, which comprises an installation module, a first construction module, a second construction module, a third construction module and a verification module, wherein the installation module is used for acquiring a first lightweight foundation image as a construction stage foundation image, installing foundation dependent items and construction tools in the construction stage foundation image, the first construction module is used for copying dependent files in a Python project into the construction stage foundation image, generating a dependent layer by combining the construction tools, the second construction module is used for copying codes in the Python project into the construction stage foundation image, executing construction steps in the codes to obtain a construction product, the third construction module is used for acquiring a second lightweight foundation image as an operation environment foundation image, copying the dependent layer and the construction product into the operation environment foundation image to obtain an initial image, and the verification module is used for carrying out compatibility verification on the initial image, if verification is passed, using the initial image as the Python project image, acquiring the corrected and re-verifying the passed initial image, and using the corrected and re-verified initial image as the Python project image.
Optionally, in a first implementation manner of the second aspect of the present invention, the installation module includes a first determining unit, configured to obtain a configuration requirement, determine a version of a first lightweight base image, a base dependency item, and a build tool based on the configuration requirement, a first obtaining unit, configured to obtain, based on the determined version, the first lightweight base image of a corresponding version from an official image library as a build stage base image, and an installation unit, configured to install the base dependency item and the build tool in a file system layer created by the build stage base image.
Optionally, in a second implementation manner of the second aspect of the present invention, the first building module includes a first copying unit, configured to copy a dependent file in a Python project from a local project directory to a working directory of the building stage base image, a first generating unit, configured to generate a dependent installation instruction according to the dependent file, and a first building unit, configured to generate a dependent layer in combination with the building tool based on the dependent installation instruction.
Optionally, in a third implementation manner of the second aspect of the present invention, the second building module includes a second copying unit, configured to copy the code in the Python project from the local project directory to the working directory of the building stage base mirror image, a second generating unit, configured to generate a plurality of shell scripts based on the building steps in the code, and a second building unit, configured to execute the shell scripts in Dockerfile to obtain a building product.
Optionally, in a fourth implementation manner of the second aspect of the present invention, the third building module includes a second determining unit, configured to obtain a configuration requirement, determine a version of a second lightweight base image based on the configuration requirement, a second obtaining unit, configured to obtain, based on the determined version, the second lightweight base image of a corresponding version from an official image library as an operating environment base image, and a third building unit, configured to copy the dependency layer and the building product into the operating environment base image, and delete a cache file, a temporary file, and a non-operating required file to obtain an initial image.
Optionally, in a fifth implementation manner of the second aspect of the present invention, the verification module includes a third obtaining unit, configured to obtain a preset compatibility verification index, where the compatibility verification index includes a Python version, a dependent library compatibility, and an operating system compatibility, the verification unit is configured to perform compatibility verification on the initial image based on the compatibility verification index to obtain a verification result, and the processing unit is configured to use the initial image as a Python item image if the verification result is verification passing, and to obtain a corrected and re-verified initial image if the verification result is verification failing, and to use the corrected and re-verified initial image as a Python item image.
A third aspect of the present invention provides a Python item mirror image construction apparatus comprising a memory and at least one processor, the memory having stored therein computer readable instructions, the memory and the at least one processor being interconnected by a wire, the at least one processor invoking the computer readable instructions in the memory to cause the Python item mirror image construction apparatus to perform the steps of the Python item mirror image construction method as described above.
A fourth aspect of the present invention provides a computer-readable storage medium having stored therein computer-readable instructions which, when run on a computer, cause the computer to perform the steps of the Python item mirror image construction method as described above.
According to the technical scheme provided by the invention, a multi-stage construction strategy is adopted, the first lightweight base mirror image and the second lightweight base mirror image are used as the bases of a construction stage and an operation environment, the size of the mirror image is effectively reduced, so that the downloading, loading and operation speeds of the mirror image are increased, the construction process is more focused on generating necessary dependent layers and construction products by separating the construction stage and the operation environment, no extra components are needed in operation, the construction efficiency is improved, meanwhile, the dependent layers, the construction products and the operation environment are respectively processed, each part can be independently modified and reused, in addition, by carrying out strict compatibility check on an initial mirror image, the matching of components in the mirror image with project requirements is ensured, the operation errors and performance problems caused by the compatibility problem are reduced, a mechanism for correcting and re-checking the mirror image which is failed in check is provided, and the finally used mirror image is ensured to pass through strict check, so that the stability and reliability of a project are improved.
Detailed Description
The embodiment of the invention provides a method, a device, equipment and a storage medium for constructing a Python item mirror image. The method comprises the steps of obtaining a first lightweight basic image as a construction stage basic image, installing basic dependency items and construction tools in the construction stage basic image, copying dependency files in a Python project into the construction stage basic image, generating a dependency layer by combining the construction tools, copying codes in the Python project into the construction stage basic image, executing construction steps in the codes to obtain a construction product, obtaining a second lightweight basic image as an operation environment basic image, copying the dependency layer and the construction product into the operation environment basic image to obtain an initial image, carrying out compatibility check on the initial image, if the initial image passes the check, using the initial image as the Python project image, if the check fails, obtaining the corrected and re-checked initial image, and using the corrected and re-checked initial image as the Python project image.
The terms "first," "second," "third," "fourth" and the like in the description and in the claims and in the above drawings, if any, are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate such that the embodiments described herein may be implemented in other sequences than those illustrated or otherwise described herein. Furthermore, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed or inherent to such process, method, article, or apparatus.
For easy understanding, a specific flow of an embodiment of the present invention is described below, referring to fig. 1, and a first embodiment of a Python project mirror image construction method in an embodiment of the present invention includes:
s101, acquiring a first lightweight base image as a construction stage base image, and installing base dependent items and construction tools in the construction stage base image.
It will be appreciated that the execution subject of the present invention may be a Python project mirror construction apparatus, and may also be a terminal or a server, which is not limited herein. The embodiment of the invention is described by taking a server as an execution main body as an example.
In this embodiment, the lightweight base mirror image refers to those mirrors that are smaller in size and have low resource occupation, and can meet the basic operation requirements. For example, alpine, debian Slim, ubuntu Slim, scatch and Distroless.
S102, copying the dependent file in the Python project into the construction stage base mirror image, and generating a dependent layer by combining a construction tool.
In this embodiment, the COPY instruction is used to COPY the requirements. Txt or similar dependent files in the Python item into the build phase base image. These dependencies are then installed using PIP INSTALL commands, which will be installed in a particular layer of the build phase base image, i.e., a Docker layer containing all item dependencies is generated.
S1013, copying codes in the Python project into a construction stage base mirror image, and executing construction steps in the codes to obtain a construction product.
In this embodiment, the COPY instruction is used to COPY the source code in the Python item into the build phase base image. Project-specific build steps (e.g., compiling Cython code, preprocessing data, etc.) are then performed as needed to obtain a build product (e.g., executable file, packaged library, etc.).
S104, acquiring a second lightweight base image as an operation environment base image, and copying the dependency layer and the construction product into the operation environment base image to obtain an initial image.
In this embodiment, a new lightweight base image is selected as the running environment base image, and then the dependency layer and build product are copied from the build phase base image into the running environment base image using the COPY-from= < build phase image name > instruction, resulting in an initial image that contains only the minimum set (dependency and build product) required for the running item.
In this embodiment, the second lightweight base image and the first lightweight base image may be the same or different.
S105, carrying out compatibility verification on the initial image, if verification passes, using the initial image as a Python item image, if verification fails, acquiring the corrected and re-verified initial image, and using the corrected and re-verified initial image as the Python item image.
In this embodiment, if the initial image passes the compatibility check, the image may be directly used as the Python item image.
And if the initial image fails the compatibility verification, correcting the image according to the verification result. Modifications include operations to update the Python version or the dependency library version, add or delete necessary dependencies, modify Dockerfile to alter the build process, and the like.
After correction, reconstructing the image and carrying out compatibility verification again until verification is passed, obtaining the corrected and re-verified initial image, and using the corrected and re-verified initial image as the Python project image.
In this embodiment, metadata may also be indirectly added by tagging (tagging) the image. For example, an initial image may be constructed and marked using a dock build-t my-python-project 1.0 command, where 1.0.0 is metadata about the version of the initial image, by tagging the image, images of different versions may be easily managed and rolled back to the previous version as needed. In addition, the tags provide additional contextual information about the mirrored content, facilitating communication and collaboration between team members.
The embodiment provides a Python project image construction method, which adopts a multi-stage construction strategy, uses a first lightweight basic image and a second lightweight basic image as the basis of a construction stage and an operation environment, effectively reduces the size of the image, thereby accelerating the downloading, loading and operation speed of the image, and provides a mechanism for correcting and re-checking the image failed in verification by separating the construction stage and the operation environment so that the construction process is more focused on generating necessary dependency layers and construction products without containing additional components which are not needed in operation, thereby improving the construction efficiency, and simultaneously processing the dependency layers, the construction products and the operation environment respectively, so that each part can be independently modified and reused.
Referring to fig. 2, a second embodiment of a Python project image construction method according to an embodiment of the present invention includes:
s201, acquiring configuration requirements, and determining a version of the first lightweight base image, base dependent items and a construction tool based on the configuration requirements.
In this embodiment, the configuration requirements include the required Python version, operating system type, base dependencies (e.g., library, framework, etc.), and build tools (e.g., pip, make, gcc, etc.).
In this embodiment, according to a preset relationship table between the configuration requirement and the first lightweight base image version, after determining the configuration requirement, the relationship table between the configuration requirement and the first lightweight base image version may be queried to determine the version of the first lightweight base image.
Similarly, a relationship table of association between the configuration requirements and the basic dependency items and a relationship table of association between the configuration requirements and the construction tools are preset. After determining the configuration requirement, the base dependency and the build tool may be determined by querying a set configuration requirement and base dependency association table and a set configuration requirement and build tool association table.
S202, acquiring a first lightweight base image of a corresponding version from an official image library based on the determined version to serve as a construction stage base image.
It will be appreciated that the Docker Hub is a mirrored warehouse service provided by Docker authorities and is also the most widely used official mirrored warehouse at present.
In this embodiment, the first lightweight base image is a python:3.9-slim image.
S203, the foundation dependent items and the construction tool are installed in a file system layer created by the foundation mirror image at the construction stage.
In this embodiment, after entering the mirror environment of the build phase base mirror, the base dependency is installed using the package management tool (e.g., apt) of the operating system, then the build tool pip is installed, i.e., the package management tool pip of Python is used for installation, by executing PIP INSTALL PIP to ensure that the pip tool is the latest version, then the write package is installed, and the PIP INSTALL WHEEL command is executed.
In the embodiment, by using the lightweight base mirror image and the standardized construction flow, the advantages of efficient utilization of resources, acceleration of the construction process, portability and safety improvement of the application program, clear management of the dependency relationship and easiness in maintenance and updating are realized.
Referring to fig. 3, a third embodiment of a Python project mirror image construction method according to an embodiment of the present invention includes:
S301, copying the dependent files in the Python project from the local project catalog to the working catalog of the construction stage basic mirror image.
In this embodiment, at Dockerfile, the dependency files in the local project directory are copied into the specified working directory of the build phase base image using the COPY instruction. For example, the COPY requirements. Txt/app/will COPY the requirements. Txt file into the app/directory of the build phase base image.
S302, generating a dependent installation instruction according to the dependent file.
In this embodiment, an instruction for installing a dependency is generated and executed from the copied dependency file within the build-phase base image.
S303, generating a dependency layer by combining the construction tool based on the dependency installation instruction.
In this embodiment, the dependent mount instruction is executed using the RUN instruction in conjunction with a build tool (e.g., pip) based on the dependent mount instruction. For example, RUN PIP INSTALL-r/app/requirements.txt may be installed according to the dependencies listed in the app/requirements.txt file, thereby generating a dependency layer.
In this embodiment, the dependent file in the Python item is copied from the local item directory to the working directory of the basic mirror image of the construction stage, the dependent installation instruction is generated according to the dependent file, the dependent layer is generated based on the dependent installation instruction in combination with the construction tool, it can be ensured that the dependence of the Python item is correctly installed in the construction stage, and the result is saved as a reusable, portable and safe mirror image layer, which is helpful for improving the construction efficiency, maintainability and safety of the item.
Referring to fig. 4, a fourth embodiment of a Python project mirror image construction method according to an embodiment of the present invention includes:
S401, copying codes in the Python project from the local project catalog to the working catalog of the construction stage basic mirror image.
In this embodiment, the code in the Python item is copied from the local item directory into the working directory of the build phase base image, i.e., the local item directory (or specific files therein) is copied into the working directory of the build phase base image using the COPY instruction at Dockerfile. For example, the copy/src/app/src will copy the local src directory into the app/src directory of the build phase base image, facilitating the execution of the build steps inside the build phase base image.
S402, generating a plurality of shell scripts based on the construction steps in the codes.
In this embodiment, the build steps in the project (e.g., install dependencies, compile code, run test, etc.) are abstracted into shell scripts for invocation at Dockerfile.
Specifically, one or more shell scripts are generated according to project construction requirements, and the shell scripts comprise commands required for executing construction steps. For example, a script named build. Sh contains PIP INSTALL-r requirements. Txt to install Python dependent items, and Python setup. Py build to compile project code.
S403, executing the shell script in Dockerfile to obtain a construction product.
In this embodiment, shell scripts are invoked at Dockerfile to perform the build steps and generate the build product.
Specifically, the RUN instruction is used in Dockerfile to execute the shell script. Ensuring that the correct working directory has been set by WORKDIR instructions before the script is executed. For example, WORKDIR/app/src sets the working directory to/app/src, and then run/build.sh executes the build.sh script. After the script is executed, the build product (e.g., compiled binary file, packaged library, etc.) will remain in the location specified in the build phase base image.
In this embodiment, the construction process is defined by Dockerfile and shell scripts, so that the same result can be obtained in each construction, the construction repeatability is improved, dockerfile and shell scripts can be easily adjusted according to project requirements to adapt to different construction environments and construction steps, in addition, the construction steps are executed in the basic mirror image of the construction stage, the consistency and isolation of the construction environments can be ensured, and the influence of local development environment differences on the construction result is avoided.
Referring to fig. 5, a fifth embodiment of a Python project mirror image construction method according to an embodiment of the present invention includes:
s501, acquiring configuration requirements, and determining the version of the second lightweight base image based on the configuration requirements.
In this embodiment, the configuration requirements include the required Python version, operating system type, base dependencies (e.g., library, framework, etc.), and build tools (e.g., pip, make, gcc, etc.), in this embodiment.
In this embodiment, according to a preset relationship table between the configuration requirement and the second light-level base image version, after determining the configuration requirement, the relationship table between the configuration requirement and the second light-level base image version may be queried to determine the version of the second light-level base image.
S502, acquiring a second lightweight base image of a corresponding version from the official image library based on the determined version to serve as an operation environment base image.
In this embodiment, the second lightweight base image is a python:3.9-alpine image.
In this embodiment, the second lightweight base image of the corresponding version is obtained FROM the official image library as the running environment base image, which specifically includes designating the second lightweight base image as a python:3.9-alpine image using the FROM instruction in Dockerfile. For example, FROM python 3.9-alpine will pull a mirror image of the python 3.9-alpine version FROM the Docker Hub.
S503, copying the dependent layer and the construction product into the running environment basic mirror image, and deleting the cache file, the temporary file and the files which are not required by running to obtain an initial mirror image.
In the embodiment, copying the dependent layer and the construction product into the running environment basic mirror image, deleting the cache file, the temporary file and the files which are not required by running to obtain an initial mirror image, wherein the method specifically comprises the steps of copying the dependent layer and the construction product into the running environment basic mirror image; calling a preset deleting script, traversing files and catalogues in the basic mirror image of the running environment by using the deleting script, deleting non-running required files to obtain an initial mirror image, wherein the initial mirror image comprises all dependency items and construction products required by running an application program, and simultaneously removing unnecessary files.
In the embodiment, the lightweight running environment basic mirror image is used, and the initial mirror image is obtained by combining the deletion of the cache file, the temporary file and the non-running required file, so that the volume of the initial mirror image can be obviously reduced, the deployment efficiency is improved, and the resource consumption is reduced.
Referring to fig. 6, a sixth embodiment of a Python project mirror image construction method according to an embodiment of the present invention includes:
S601, acquiring preset compatibility check indexes, wherein the compatibility check indexes comprise Python version, dependency library compatibility and operating system compatibility.
In this embodiment, library compatibility, such as version range of a particular library, operating system compatibility, such as operating system version, architecture, etc., is relied upon.
S602, carrying out compatibility verification on the initial mirror image based on the compatibility verification index to obtain a verification result.
In this embodiment, a compatibility check script may be written, and when the initial image is subjected to compatibility check, the compatibility check script is directly called to execute the compatibility check. The check result is typically a boolean value indicating whether the check passed.
And S603, if the verification result is verification passing, using the initial image as the Python item image, and if the verification result is verification failure, acquiring the corrected and re-verified initial image, and using the corrected and re-verified initial image as the Python item image.
In this embodiment, if the verification result is "verification pass", the subsequent steps are continued, and the initial image is used as the Python item image. If the verification result is 'verification failure', entering a correction processing flow, acquiring a corrected and re-verified initial image fed back by the correction processing flow, and using the corrected and re-verified initial image as a Python item image.
Specifically, the revision process includes modifying Dockerfile, updating a dependent file, repairing a known problem in the base image, or switching to another image version that meets compatibility requirements. After the correction is completed, the compatibility check is re-executed. This step is repeated until an initial mirror image is obtained that passes the verification.
In this embodiment, the initial image is subjected to compatibility verification, so that a runtime error or performance problem caused by environmental incompatibility can be avoided, the compatibility problem can be found and solved in time, and the subsequent maintenance workload caused by environmental problems is reduced.
The above describes a method for constructing a Python item mirror image in an embodiment of the present invention, and the following describes an apparatus in an embodiment of the present invention, referring to fig. 7, where an implementation manner of the Python item mirror image constructing apparatus in an embodiment of the present invention includes:
an installation module 701, configured to obtain a first lightweight base image as a build stage base image, and install a base dependency item and a build tool in the build stage base image;
a first building module 702, configured to copy the dependency files in the Python project into the build phase base image, and generate a dependency layer in conjunction with the build tool;
A second construction module 703, configured to copy the code in the Python item into the construction phase base image, and perform a construction step in the code to obtain a construction product;
a third building module 704, configured to obtain a second lightweight base image as an operating environment base image, copy the dependency layer and the building product into the operating environment base image, and obtain an initial image;
And the checking module 705 is configured to perform compatibility checking on the initial image, if the initial image passes the checking, use the initial image as a Python item image, and if the initial image fails the checking, obtain a corrected and re-checked initial image, and use the corrected and re-checked initial image as a Python item image.
In this embodiment, the installation module 701 includes a first determining unit 7011 configured to obtain a configuration requirement, determine a version of a first lightweight base image, a base dependency item, and a build tool based on the configuration requirement, a first obtaining unit 7012 configured to obtain, based on the determined version, the first lightweight base image of a corresponding version from an official image library as a build stage base image, and an installation unit 7013 configured to install the base dependency item and the build tool in a file system layer created by the build stage base image.
In this embodiment, the first building module 702 includes a first copying unit 7021 for copying a dependent file in a Python project from a local project directory to a working directory of the building stage base image, a first generating unit 7022 for generating a dependent installation instruction according to the dependent file, and a first building unit 7023 for generating a dependent layer according to the dependent installation instruction in combination with the building tool.
In this embodiment, the second building module 703 includes a second copying unit 7031 for copying the code in the Python project from the local project directory to the working directory of the building stage base image, a second generating unit 7032 for generating a plurality of shell scripts based on the building steps in the code, and a second building unit 7033 for executing the shell scripts in Dockerfile to obtain a building product.
In this embodiment, the third building module 704 includes a second determining unit 7041 for obtaining a configuration requirement, determining a version of a second lightweight base image based on the configuration requirement, a second obtaining unit 7042 for obtaining a second lightweight base image of a corresponding version from an official image library based on the determined version as an operating environment base image, and a third building unit 7043 for copying the dependency layer and the building product into the operating environment base image, and deleting a cache file, a temporary file, and a non-operating required file to obtain an initial image.
In this embodiment, the verification module 705 includes a third obtaining unit 7051 configured to obtain a preset compatibility verification index, where the compatibility verification index includes a Python version, a dependency library compatibility, and an operating system compatibility, a verification unit 7052 configured to perform compatibility verification on an initial image based on the compatibility verification index to obtain a verification result, and a processing unit 7053 configured to use the initial image as a Python item image if the verification result is verification passing, and obtain a corrected and re-verified initial image if the verification result is verification failing, and use the corrected and re-verified initial image as a Python item image.
In this embodiment, a multi-stage construction strategy is adopted, and the first lightweight base image and the second lightweight base image are used as the bases of the construction stage and the operation environment, so that the size of the images is effectively reduced, the downloading, loading and operation speeds of the images are accelerated, and the construction process is more focused on generating necessary dependency layers and construction products by separating the construction stage and the operation environment, without containing additional components which are not needed in operation, the construction efficiency is improved, meanwhile, the dependency layer, the construction product and the running environment are processed respectively, so that each part can be modified and reused independently, in addition, by carrying out strict compatibility verification on the initial mirror image, the matching of components in the mirror image and project requirements is ensured, running errors and performance problems caused by compatibility problems are reduced, a mechanism for correcting and re-verifying the mirror image with verification failure is provided, and the mirror image which is used finally is ensured to pass through the strict verification, so that the stability and reliability of the project are improved.
Fig. 7 above describes the Python item mirror image construction apparatus in the embodiment of the present invention in detail from the point of view of a modularized functional entity, and the Python item mirror image construction device in the embodiment of the present invention is described in detail from the point of view of hardware processing.
Fig. 8 is a schematic structural diagram of a Python project mirror construction apparatus according to an embodiment of the present invention, where the apparatus 800 may have a relatively large difference due to different configurations or performances, and may include one or more processors (central processing units, CPU) 810 (e.g., one or more processors) and a memory 820, and one or more storage mediums 830 (e.g., one or more mass storage devices) storing application programs 833 or data 832. Wherein memory 820 and storage medium 830 can be transitory or persistent. The program stored on the storage medium 830 may include one or more modules (not shown), each of which may include a series of instruction operations in the device 800. Still further, the processor 810 may be arranged to communicate with a storage medium 830 in which a series of instruction operations are performed on the device 800.
The device 800 may also include one or more power supplies 840, one or more wired or wireless network interfaces 850, one or more input/output interfaces 860, and/or one or more operating systems 831, such as Windows Serve, mac OS X, unix, linux, freeBSD, and the like.
The embodiment of the invention also provides a computer readable storage medium, which can be a nonvolatile computer readable storage medium, and can also be a volatile computer readable storage medium, wherein instructions are stored in the computer readable storage medium, and when the instructions run on a computer, the instructions cause the computer to execute the steps of the Python project mirror image construction method.
It will be clearly understood by those skilled in the art that, for convenience and brevity of description, the specific working process of the system or apparatus and unit described above may refer to the corresponding process in the foregoing method embodiment, which is not repeated herein.
The integrated units, if implemented in the form of software functional units and sold or used as stand-alone products, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention may be embodied essentially or in part or all of the technical solution or in part in the form of a software product stored in a storage medium, including instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method according to the embodiments of the present invention. The storage medium includes a U disk, a removable hard disk, a read-only memory (ROM), a random access memory (random access memory, RAM), a magnetic disk, an optical disk, or other various media capable of storing program codes.
While the invention has been described in detail with reference to the foregoing embodiments, it will be understood by those skilled in the art that the foregoing embodiments may be modified or equivalents may be substituted for some of the features thereof, and that the modifications or substitutions do not depart from the spirit and scope of the embodiments of the invention.