Skip to content
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

refactor: avoid twice parse Dockerfile #692

Conversation

orisano
Copy link
Contributor

@orisano orisano commented Jun 4, 2019

avoid twice parse Dockerfile

Copy link
Member

@tejal29 tejal29 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@orisano Can you please explain how this is avoiding parsing dockerfile twice?
Also please add some tests to make sure dockefile is parsed just once.

@antechrestos
Copy link
Contributor

@orisano @tejal29 I can contribute if needed. I understand what @orisano did

In the beginning of DoBuild, we have

stages, err := dockerfile.Stages(opts)

then couple of lines later

crossStageDependencies, err := CalculateDependencies(opts)

then at the beginning of CalculateDependencies: stages, err := dockerfile.Stages(opts)

Hence, making CalculateDependencies private and passing stages as parameters is a good option.

I can contribute if needed and find a way to enforce the face that the file gets loaded only once.

@antechrestos antechrestos mentioned this pull request Feb 8, 2020
3 tasks
@antechrestos
Copy link
Contributor

@orisano This pull request made the job

@orisano orisano closed this May 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants