-
Notifications
You must be signed in to change notification settings - Fork 83
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
feat: support for multi-stage builds #84
Conversation
@marccampbell @emosbaugh Would love a review of this if you get a chance. 😎 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
@emosbaugh Thanks for the quick turnaround! Will wait to hear from #74 commenters before I proceed. |
bde16c3
to
ed00203
Compare
@marccampbell @emosbaugh Thoughts on making this a major version bump? This question is the only reason I'm hesitant to merge and release this right now. |
ed00203
to
9970cce
Compare
i see no reason to bump major version. no big refactor or anything and nothing incompatible or api changes |
Fair enough. I'll merge and release as a minor update then. Thanks! |
Published to npm as 1.4.0. |
interpret multiple FROM commands as multi-stage builds
Fixes #74.
The first commit adds tests for multi-stage builds (examples taken from Docker's documentation), which should fail.
The subsequent commits modify logic to get the tests to pass.
Instead of failing on each subsequent
FROM
command, the logic now considers this as the beginning of a new build stage (as modeled by internal state during instructions processing).NOTE: This should probably be considered a BREAKING CHANGE, since Dockerfiles containing more than one
FROM
command will no longer fail linting, which will be problematic if the (unspecified) target Docker version is less than 17.05. We could potentially get around this by introducing a way (e.g. CLI/config option or auto env detection) to specify/detect the Docker version, but this seems out-of-scope for this PR.Also note that this change does not add any new checks specific to multi-stage Dockerfiles, such as potentially checking that a stage has more than just a single
FROM
command. Even so, the changes represented here could be considered a necessary first step, allowing stage-specific checks to be added later.