-
Notifications
You must be signed in to change notification settings - Fork 188
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Perform analysis on multistage Dockerfiles #612
Comments
Maybe i can work on this issue! |
Hi nisha, here is my plan: 1. Build
into
Dockerfile2: Stage 1 + Stage 2
I am not spliting into seperate stages since the second stage may need to copy files from the previous stage(Stage 2 has dependcy on Stage 1). 2.Analyze
Stage 2
This is different from |
@ForgetMe17 That makes sense to me. All the information collected when analyzing an image built from Dockerfile1 are stored in the |
Implemented two functions: 1. check_mutistage_dockerfile(): Given a dockerfile object, return if it is a multistage dockerfile. 2. split_multistage_dockerfile(): Given a multistage dockerfile object, return the splited dockerfile object list. Works towards tern-tools#767. Super issue tern-tools#612. Signed-off-by: WangJL <hazard15020@gmail.com>
This commit adds two functions to implement building a multistage dockerfile to get its images by the stages. 1. get_multistage_image_dockerfiles() at tern\analyze\docker\dockerfile.py: This function splits a multistage dockerfile into dockerfiles by its stage for build. 2. build_multistage() at tern\analyze\docker\run.py: This functions builds a multistage dockerfile to get the images for analyze. So far we can build the dockerfile and the further jobs like analyze and clean up are implement by other commits. Works towards tern-tools#612. Signed-off-by: WangJL <hazard15020@gmail.com>
This commit adds two functions to implement building a multistage dockerfile to get its images by the stages. 1. get_multistage_image_dockerfiles() at tern\analyze\docker\dockerfile.py: This function splits a multistage dockerfile into dockerfiles by its stage for build. 2. build_multistage() at tern\analyze\docker\run.py: This functions builds a multistage dockerfile to get the images for analyze. So far we can build the dockerfile and the further jobs like analyze and clean up are implement by other commits. Works towards tern-tools#612. Signed-off-by: WangJL <hazard15020@gmail.com>
This commit adds two functions to implement building a multistage dockerfile to get its images by the stages. 1. get_multistage_image_dockerfiles() at tern\analyze\docker\dockerfile.py: This function splits a multistage dockerfile into dockerfiles by its stage for build. 2. build_multistage() at tern\analyze\docker\run.py: This functions builds a multistage dockerfile to get the images for analyze. So far we can build the dockerfile and the further jobs like analyze and clean up are implement by other commits. Works towards tern-tools#612. Signed-off-by: WangJL <hazard15020@gmail.com>
This commit add 3 functions in tern\analyze\docker\dockerfile.py。 1. check_multistage_dockerfile() to check if the given dockerfile is a multistage dockerfile, return True or Flase and the index of FROM line. 2. get_multistage_image_dockerfiles() to split multistage dockerfile into seperate dockerfiles for build. 3. write_dockerfile_by_structure() to write a dockerfile by the dfobj structure. Works towards tern-tools#767. Super issue tern-tools#612. Signed-off-by: WangJL <hazard15020@gmail.com>
This commit add 3 functions in tern\analyze\docker\dockerfile.py。 1. check_multistage_dockerfile() to check if the given dockerfile is a multistage dockerfile, return True or Flase and the index of FROM line. 2. get_multistage_image_dockerfiles() to split multistage dockerfile into seperate dockerfiles for build. 3. write_dockerfile_by_structure() to write a dockerfile by the dfobj structure. Works towards tern-tools#767. Super issue tern-tools#612. Signed-off-by: WangJL <hazard15020@gmail.com>
1. In tern\analyze\docker\dockerfile.py, add function split_multistage_dockerfile_by_stage() to split by stage. 2. In tern\analyze\docker\run.py, add function build_multistage(), this is a draft version for building and analyzing multistage dockerfile. Works towards tern-tools#612. Signed-off-by: WangJL <hazard15020@gmail.com>
1. In tern\analyze\docker\dockerfile.py, add function split_multistage_dockerfile_by_stage() to split by stage. 2. In tern\analyze\docker\run.py, add function build_multistage(), this is a draft version for building and analyzing multistage dockerfile. Works towards tern-tools#612. Signed-off-by: WangJL <hazard15020@gmail.com>
Add function execute_multistage_dockerfile(args) in tern\analyze\docker\run.py. This function iterate the stages in the multistage dockerfile and use execute_dockerfile() for each stage. Works towards tern-tools#612. Signed-off-by: WangJL <hazard15020@gmail.com>
Add function execute_multistage_dockerfile(args) in tern\analyze\docker\run.py. This function iterate the stages in the multistage dockerfile and use execute_dockerfile() for each stage. Works towards tern-tools#612. Signed-off-by: WangJL <hazard15020@gmail.com>
Add function execute_multistage_dockerfile(args). This function iterate the stages in the multistage dockerfile and use execute_dockerfile() for each stage. Works towards tern-tools#612. Signed-off-by: WangJL <hazard15020@gmail.com> Signed-off-by: Nisha K <nishak@vmware.com>
Describe the Feature
Tern can read a Dockerfile, build and image and analyze the image to provide a report and pin a Dockerfile. However, it cannot do these for multistage Dockerfiles accurately because the intermediate stages get thrown away after a build is complete. Why not enable analysis and pinning for multistage Dockerfiles?
Use Cases
Multistage Dockerfiles are the de-facto build mechanism for golang projects in particular. A Dockerfile will typically use the golang image to build and an alpine image to deploy the built golang binary.
Implementation Changes
A proposed implementation can look like this:
The text was updated successfully, but these errors were encountered: