An agent-based open source project mirror image construction plan intelligent generation method and system
By using Agent-based intelligent analysis technology, open-source project image build plans are automatically detected and generated, solving the image build challenges for users without technical backgrounds. This enables an efficient and automated image build process that adapts to the needs of different technology stacks and automatically fixes errors.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- LINGKEYUN (BEIJING) TECHNOLOGY CO LTD
- Filing Date
- 2026-02-09
- Publication Date
- 2026-06-05
AI Technical Summary
In existing technologies, users without technical backgrounds find it difficult to independently build open-source project images. Existing image building tools cannot support projects without Dockerfiles, and image building failures are difficult to automatically repair, resulting in low building efficiency and frequent errors.
Employing Agent-based intelligent analysis technology, it automatically detects code types and generates image build plans. It supports parsing Dockerfile and docker-compose.yml files to generate Dockerfiles, or dynamically generates Dockerfiles based on the code technology stack, enabling intelligent generation and automatic repair of image build plans.
It lowers the technical threshold, supports image building for users with different technical levels, improves build efficiency, reduces manual configuration errors, and achieves efficient and automated repair of image build plans.
Smart Images

Figure CN122152329A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of open source project building technology, specifically to an agent-based intelligent generation method and system for open source project image building plans. Background Technology
[0002] With the rapid popularization of AI technology, there is a huge demand from developers, researchers, and business personnel without technical backgrounds for successfully building open-source project images: 1. Users without a technical background who lack knowledge of image building will find it difficult to independently build open-source project images; 2. Most existing image building tools only support open-source projects that already include a Dockerfile, and cannot support projects without a Dockerfile; 3. When technicians transform open-source projects without Dockerfiles into images, they need to manually write Dockerfiles and adapt to the configuration specifications of different technology stacks (such as Python, Java, Node.js, etc.). The process is cumbersome and error-prone, resulting in low efficiency in generating image build plans. 4. For projects that already have a Dockerfile, the actual build process may fail due to errors in the content or format of the Dockerfile, making the cause difficult to identify and impossible to automatically fix.
[0003] The current mainstream Docker deployment solutions for open-source projects rely heavily on users manually writing Dockerfiles. Users must first specify the project's development language, dependencies, startup commands, port configurations, and other details, then write the corresponding instructions according to Docker syntax rules. They then build the image using the `Docker build` command and finally start the container based on the image. Some cloud service platforms (such as Alibaba Cloud Container Service and AWS ECS) provide image building tools, but these still essentially require users to upload custom Dockerfiles or manually modify configuration parameters based on the platform's templates to complete the build process. Summary of the Invention
[0004] Therefore, the technical problem to be solved by the present invention is to provide an agent-based intelligent generation method and system for open source project image build plans. After automatic analysis by the agent, a usable image build plan is generated by directly selecting a Dockerfile or generating it dynamically. It also supports automatic repair after image build failure, realizing low-threshold and high-efficiency generation of open source project image build plans, covering the diverse needs of users with different technical levels.
[0005] To solve the above-mentioned technical problems, the present invention provides the following technical solution: An agent-based intelligent generation method for open-source project image build plans includes the following steps: S100) The user enters a smart image build plan request, and simultaneously enters the code repository address and / or uploads a code compressed package; S200) Based on the code source type input by the user, execute the corresponding code retrieval operation and store the corresponding code in the temporary storage node; The S300 intelligent image generation build plan has the following specific steps: S301) Detect the code stored in the temporary storage node in step S200, and distribute tasks according to the following strategy and set the provider field in the image build plan: R1) If the docker-compose.yml file is detected, the task is distributed to Docker ComposeAgent, and the provider field is set to docker; R2) If a Dockerfile is detected but a docker-compose.yml file is not detected, the task is distributed to the Dockerfile Agent, and the provider field is set to docker. R3) If neither the Dockerfile nor the docker-compose.yml file is detected, the task will be distributed to the Non-Dockerized Agent, and the provider field will be set to pending. S302) The Docker Compose Agent, Dockerfile Agent, and Non-Dockerized Agent each execute the assigned tasks and analyze the project; S303) Based on the execution result of step S302, generate one or more image build plans.
[0006] In the above-mentioned agent-based intelligent generation method for open-source project image build plans, if an error occurs during the build process, the Dockerfile repair interface is called to submit the image build plan and error information, and then the Dockerfile repair agent automatically repairs the image build plan.
[0007] In the above agent-based intelligent generation method for open-source project image build plans, in step S302), the DockerCompose Agent processes the task through the following steps: A1) Call Read File to read and parse docker-compose.yml; A2) Traverse each service under services and perform the corresponding operation according to the following strategy: (CL1) If the service contains the image directive, the image name can be extracted directly and the image field of the image build plan can be filled to complete the processing of the service; (CL2) If the service contains a build instruction, first obtain the build.context and build.dockerfile paths, then call the Dockerfile Agent and use the build fields related to each service in docker-compose.yml to generate the corresponding Dockerfile for each service; A3) Generate a list containing multiple image build plans based on the execution result of step A2), where each plan corresponds to one service in the list.
[0008] In the above agent-based intelligent generation method for open-source project image build plans, in step S302), the Dockerfile Agent processes the task through the following steps: B1) Set the path: Fill in the dockerfile_path field; B2) Read content: Call the Read File tool to read the complete content of the Dockerfile and populate the dockerfile_content field; B3) Information Extraction: Parse the Dockerfile content and combine it with other files in the project to infer the language, language_version, and framework; B4) Dependency Analysis: Analyze the RUN command to identify system dependencies installed via apt-get or apk and populate the apt-deps field.
[0009] In the above agent-based intelligent generation method for open-source project image building plans, in step S302), the Non-Dockerized Agent processes the task through the following steps: C1) Technology stack identification: Identify key files by listing files / Dir and reading file, and populate the provider, language, language_version, framework, and build_tool fields based on the identified file content; C2) Knowledge base query: Call the Knowledge Read tool, input the identified technology stack information, and then the knowledge base will return the best practices corresponding to the technology stack. The best practices include recommended base images, commonly used system dependencies and multi-stage build templates; C3) Dockerfile generation: Based on the multi-stage build template returned by the knowledge base, the dockerfile_content is built step by step. Then, the recommended base image is used to add instructions to install system and project dependencies, as well as instructions to copy project files. Port exposure instructions are inferred and added based on the framework default or configuration file. Finally, the startup command is generated according to the project type. C4) Set the path for the Dockerfile generated in step C3): Set dockerfile_path to . / Dockerfile.
[0010] The above-mentioned agent-based intelligent generation method for open-source project image building plans automatically completes steps S200 and 300 after step S100 is completed.
[0011] A system for generating open-source project build plans using the aforementioned agent-based intelligent generation method for open-source project image build plans includes: The input unit is used to input the intelligent image build plan request and to input the code repository address and / or upload the code compressed package; The open-source project image build plan generation unit is used to generate an open-source project build plan based on the intelligently generated image build plan request input through the input unit, the code repository address, and / or the uploaded code compressed package. The open-source project build plan unit includes a project analysis module, a code retrieval module, a project parsing module, a storage module, a configuration module, a tool management module, and a plan generation module. Specifically, the project analysis module analyzes the code type of the code stored at the input code repository address or the code type of the uploaded code compressed package; the code retrieval module retrieves code from the code repository or the code compressed package; the project parsing module parses the intelligently generated image build plan request and the code retrieved by the code retrieval module; the storage module stores the code retrieved by the code retrieval module and the parsing results from the project parsing module; the configuration module manages the configuration of the open-source project image build plan generation process; the tool management module provides LLM tools, general tools, and third-party tools; and the plan generation module generates the open-source project image build plan based on the project parsing module. Storage unit, used to store open source project image build plans; The output unit is used to output the build plan for the open-source project image. The input unit communicates with the open-source project image build plan generation unit, which in turn communicates with the storage unit and the output unit.
[0012] The aforementioned system also includes a Dockerfile repair and optimization module within the open-source project image build plan generation unit.
[0013] The aforementioned system also includes a task management module within the open-source project image build plan generation unit. The above system has multiple interactive interfaces in its input unit.
[0014] The technical solution of the present invention achieves the following beneficial technical effects: 1. Lowering the technical barrier: Through intelligent analysis, image build plans can be generated directly from existing Dockerfiles in open source projects without manual judgment, allowing users without technical backgrounds and novice developers to quickly generate image build plans; 2. Unbinding strong dependencies: For open source projects without Dockerfiles, this invention can intelligently generate a suitable Dockerfile and image build plan, realizing the image transformation of open source projects without Dockerfiles; 3. Improve configuration efficiency: During the intelligent generation of image build plans, this invention can intelligently generate an adapted image build plan based on the analysis results of the code technology stack, avoiding the complex labor and error risks of manual configuration, and shortening the generation cycle of image build plans; 4. Automatic error repair: Users can submit build results and use the Dockerfile automatic repair function in this solution to automatically repair the image build plan and improve the build success rate. Attached Figure Description
[0015] Figure 1 This is a schematic diagram of the overall architecture of the Agent-based open-source project image building plan intelligent generation system in this invention. Detailed Implementation
[0016] The present invention will be further explained below with reference to examples.
[0017] like Figure 1As shown, the Agent-based intelligent generation system for open-source project image build plans in this invention achieves low-threshold, efficient, and flexible generation of open-source project image build plans through a full-process design of "user interaction triggering - code acquisition and verification - agent intelligent analysis - image build plan generation and preview - automatic error correction". The core idea of the Agent-based intelligent generation system for open-source project image build plans is to use the Agent as the intelligent decision-making core, automatically completing code technology stack identification and dynamic generation of image build plans. Simultaneously, through modular architecture design, it takes into account core functions such as user interaction and process control, ultimately achieving an organic unity between "one-click generation" and "custom configuration".
[0018] In this invention, the overall architecture of the agent-based open-source project image building plan intelligent generation system adopts a layered modular design, mainly divided into 5 layers: API layer: Provides multi-terminal interaction entry points such as Web interface and IDE plugin interface, and is responsible for receiving user requests, triggering operations, displaying status, and performing health checks; Business service layer: Includes business services such as code repository / OSS project analysis agent, DockerCompose project / non-containerized project parsing agent, Dockerfile repair agent, task manager, etc., responsible for core logic such as code retrieval and analysis, various project adaptation parsing, Dockerfile repair, task management, etc. Core Capability Layer: Includes core capabilities such as AI intelligent analysis, Dockerfile repair / optimization, streaming output processing, asynchronous task processing, and third-party service integration, responsible for providing the basic capabilities required for business services; Data layer: Includes task data storage, analysis result storage, and project metadata storage, responsible for persistently storing project metadata data, analysis task process data, and result data throughout the entire process; Configuration and Tools Layer: This layer includes configuration management, LLM factory, third-party tool encapsulation, and a general toolset. It is responsible for providing the configuration management, LLM tools, general tools, and third-party tools required throughout the entire process. These tools specifically include: List Files / Dir: Lists files and subdirectories in a specified directory, used for project structure analysis; Read File: Reads the text content of a specified file for in-depth analysis; Git Operations (MCP): Used to obtain Git-related information, such as branches, commit history, etc. (optional, for advanced analysis). AliyunOSS Access: Used to retrieve project files uploaded by users locally; Knowledge Read: The core tool. It connects to an internal knowledge base, providing best practices for different technology stacks (such as base images, dependencies, build commands, etc.). Others: Add other tools or MCP as needed.
[0019] The API layer serves as the input unit for the Agent-based intelligent generation system for open-source project image build plans. The business service layer, core capability layer, data layer, and configuration and tool layer are all located within the open-source project image build plan generation unit.
[0020] The process of generating open-source project image build plans using the agent-based intelligent generation system for open-source project image build plans in this invention is as follows: 1. Input Project (Starting Point of Process) Users can initiate a smart image build plan request through a web interface or IDE plugin (such as the VS Code plugin). They need to enter the code repository address (such as a GitHub or Gitee link) or upload a compressed code package, and then the Agent intelligent analysis process will be automatically triggered.
[0021] 2. Code Fetch The system performs the corresponding code retrieval operation based on the type of code source input by the user: If it is a Git repository (GitHub, Gitee, etc.): Pull the latest code to a temporary storage node via the Git protocol; If it is a code compressed package: Download the user-uploaded compressed package from the object storage service (such as Alibaba Cloud OSS) and decompress it to the temporary storage node; After the code is retrieved, the system performs an integrity check on the code file to ensure that subsequent processes can be executed normally.
[0022] 3. Intelligent Image Generation Build Plan 3.1 Types of Testing Items The project analysis module is responsible for type detection. This module serves as the entry point and central scheduling center for the entire system, and its main responsibilities include: It receives the root path of the project code as input.
[0023] Use the List Files / Dir tool to scan for critical files in the project's root directory.
[0024] Decision-making logic: If the docker-compose.yml file is detected, the task will be distributed to the Docker Compose Agent.
[0025] If a Dockerfile is detected (and there is no docker-compose.yml), the task is distributed to the Dockerfile Agent.
[0026] If neither of the above is found, the project is determined to be non-Dockerized, and the task is distributed to the Non-Dockerized Agent.
[0027] Initially configure the provider field in the image build plan. If a docker-compose.yml file or a file related to Dockerfile is detected, set the provider field to docker; otherwise, temporarily set the provider to pending, to be determined by the Agent later.
[0028] 3.2 Analysis and Generation At this stage, a professional agent will conduct an in-depth analysis of the project and begin filling in the various fields of the image build plan.
[0029] 3.2.1 Dockerfile Agent Target object: Projects containing Dockerfiles.
[0030] Core task: Parse and verify the existing Dockerfile and extract information from it.
[0031] Execution steps: Set the path: Fill in the dockerfile_path field.
[0032] Read content: Call the Read File tool to read the complete content of the Dockerfile and populate the dockerfile_content field.
[0033] Information extraction: Parse the contents of the Dockerfile (such as the FROM instruction), and combine them with other files in the project (such as pom.xml) to try to deduce fields such as language, language_version, and framework.
[0034] Dependency analysis: Analyze the RUN command to identify system dependencies installed via apt-get or apk and populate the apt-deps field.
[0035] 3.2.2 Docker Compose Agent Target object: Projects containing docker-compose.yml.
[0036] Core task: Transform each service in docker-compose.yml into an independent image build plan.
[0037] Execution steps: Parse YAML: Call Read File to read and parse docker-compose.yml.
[0038] Traverse services: Process each service under services independently.
[0039] Decision branches: If the service contains the `image` directive: directly extract the image name and populate the `image` field of the image build plan. This completes the processing for this service.
[0040] If the service contains build directives: Get the paths to build.context and build.dockerfile.
[0041] The Dockerfile Agent is invoked, and the corresponding Dockerfiles for each service are generated using the build fields related to each service in docker-compose.yml, thus generating a complete image build plan.
[0042] Output: Generates a list containing multiple image build plans, with each plan corresponding to a service.
[0043] 3.2.3 Non-Dockerized Agent Target: Raw code projects without Docker configuration.
[0044] Core task: Intelligently generate a best practice Dockerfile from scratch and populate all image build plan fields.
[0045] Execution steps: Technology stack identification: Identify key files (pom.xml, package.json, pyproject.toml, go.mod, etc.) by using List Files / Dir and Read File.
[0046] Based on the file content, accurately populate the provider (e.g., nodejs), language, language_version, framework, and build_tool fields.
[0047] Knowledge base search: Call the self-developed Knowledge Read tool and pass in the identified technology stack information (e.g., language=java, framework=spring boot, version=17).
[0048] The knowledge base returns best practices for this technology stack, including: recommended base images, commonly used system dependencies (apt-deps), multi-stage build templates, etc.
[0049] Dockerfile generates: Based on the template returned by the knowledge base, dockerfile_content is built step by step.
[0050] FROM: Use the recommended base image.
[0051] RUN: A command to add system dependencies (apt-deps) and project dependencies (e.g., RUN npm install).
[0052] COPY: Adds the command to copy project files.
[0053] EXPOSE: Infers and adds port exposure directives based on the framework defaults or configuration files.
[0054] CMD / ENTRYPOINT: Generates a startup command based on the project type (such as the start script in package.json).
[0055] Path setting: Set dockerfile_path to . / Dockerfile.
[0056] 3.3 Output Image Build Plan After all agents have completed their processing, the final output will be one or more image build plans.
[0057] 3.4 Automated Repair Image Build Plan If the generated build plan encounters errors during the actual build, users can call the Dockerfile repair interface to submit the image build plan and error information, and the Dockerfile repair agent will automatically repair the image build plan.
[0058] Obviously, the above embodiments are merely illustrative examples for clear explanation and are not intended to limit the implementation. Those skilled in the art will recognize that other variations or modifications can be made based on the above description. It is neither necessary nor possible to exhaustively list all possible implementations here. However, obvious variations or modifications derived therefrom are still within the scope of protection of the claims of this patent application.
Claims
1. A method for intelligently generating open-source project image build plans based on agents, characterized in that, Includes the following steps: S100) The user enters a smart image build plan request, and simultaneously enters the code repository address and / or uploads a code compressed package; S200) Based on the code source type input by the user, execute the corresponding code retrieval operation and store the corresponding code in the temporary storage node; The S300 intelligent image generation build plan has the following specific steps: S301) Detect the code stored in the temporary storage node in step S200, and distribute tasks according to the following strategy and set the provider field in the image build plan: R1) If the docker-compose.yml file is detected, the task will be distributed to the Docker Compose Agent, and the provider field will be set to docker; R2) If a Dockerfile is detected but a docker-compose.yml file is not detected, the task is distributed to the Dockerfile Agent, and the provider field is set to docker. R3) If neither the Dockerfile nor the docker-compose.yml file is detected, the task will be distributed to the Non-Dockerized Agent, and the provider field will be set to pending. S302) The Docker Compose Agent, Dockerfile Agent, and Non-Dockerized Agent each execute the assigned tasks and analyze the project; S303) Based on the execution result of step S302, generate one or more image build plans.
2. The agent-based intelligent generation method for open-source project image build plans according to claim 1, characterized in that, In step S302), if an error occurs during the image build process, the Dockerfile repair interface is called to submit the image build plan and error information, and then the Dockerfile repair agent automatically repairs the image build plan.
3. The agent-based intelligent generation method for open-source project image build plans according to claim 1, characterized in that, In step S302), the Docker Compose Agent processes the task through the following steps: A1) Call Read File to read and parse docker-compose.yml; A2) Traverse each service under services and perform the corresponding operation according to the following strategy: (CL1) If the service contains the image directive, the image name can be extracted directly and the image field of the image build plan can be filled to complete the processing of the service; (CL2) If the service contains a build instruction, first obtain the build.context and build.dockerfile paths, then call the Dockerfile Agent and use the build fields related to each service in docker-compose.yml to generate the corresponding Dockerfile for each service, and generate a complete image build plan; A3) Generate a list containing multiple image build plans based on the execution result of step A2), where each plan corresponds to one service in the list.
4. The agent-based intelligent generation method for open-source project image build plans according to claim 1, characterized in that, In step S302), the Dockerfile Agent processes the task through the following steps: B1) Set the path: Fill in the dockerfile_path field; B2) Read content: Call the Read File tool to read the complete content of the Dockerfile and populate the dockerfile_content field; B3) Information Extraction: Parse the Dockerfile content and combine it with other files in the project to infer the language, language_version, and framework; B4) Dependency Analysis: Analyze the RUN command to identify system dependencies installed via apt-get or apk and populate the apt-deps field.
5. The agent-based intelligent generation method for open-source project image build plans according to claim 1, characterized in that, In step S302), the Non-Dockerized Agent processes the task through the following steps: C1) Technology stack identification: Identify key files by listing files / Dir and reading file, and populate the provider, language, language_version, framework, and build_tool fields based on the identified file content; C2) Knowledge base query: Call the Knowledge Read tool, input the identified technology stack information, and then the knowledge base will return the best practices corresponding to the technology stack. The best practices include recommended base images, commonly used system dependencies and multi-stage build templates; C3) Dockerfile generation: Based on the multi-stage build template returned by the knowledge base, the dockerfile_content is built step by step. Then, the recommended base image is used to add instructions to install system and project dependencies, as well as instructions to copy project files. Port exposure instructions are inferred and added based on the framework default or configuration file. Finally, the startup command is generated according to the project type. C4) Set the path for the Dockerfile generated in step C3): Set dockerfile_path to . / Dockerfile.
6. The agent-based intelligent generation method for open-source project image build plans according to claim 1, characterized in that, After step S100 is completed, steps S200 and 300 will be completed automatically.
7. A system for generating open-source project build plans using the agent-based intelligent generation method for open-source project image build plans as described in claim 1, characterized in that, include: The input unit is used to input the intelligent image build plan request and to input the code repository address and / or upload the code compressed package; The open-source project image build plan generation unit is used to generate an open-source project build plan based on the intelligently generated image build plan request and the code repository address and / or uploaded code compressed package input through the input unit. The open-source project build plan unit includes a project analysis module, a code retrieval module, a project parsing module, a storage module, a configuration module, a tool management module, and a plan generation module. Among them, the project analysis module is used to analyze the code type of the code stored at the input code repository address or the code type of the code in the uploaded code compressed package; the code retrieval module is used to retrieve code from the code repository or the code compressed package; the project parsing module is used to parse the intelligently generated image build plan request and the code retrieved by the code retrieval module; the storage module is used to store the code retrieved by the code retrieval module and the parsing results of the project parsing module; the configuration module is used to configure and manage the open-source project image build plan generation process; the tool management module is used to provide LLM tools, general tools, and third-party tools; and the plan generation module is used to generate an open-source project image build plan based on the project parsing module. Storage unit, used to store open source project image build plans; The output unit is used to output the build plan for the open-source project image. The input unit communicates with the open-source project image build plan generation unit, which in turn communicates with the storage unit and the output unit.
8. The system according to claim 7, characterized in that, The open-source project image build plan generation unit also includes a Dockerfile repair and optimization module.
9. The system according to claim 7, characterized in that, The open-source project image build plan generation unit also includes a task management module.
10. The system according to claim 7, characterized in that, The input unit is equipped with multiple interactive interfaces.