Skip to content

Commit

Permalink
Merge pull request #952 from thaJeztah/18.09_backport_fix_empty_docke…
Browse files Browse the repository at this point in the history
…rfile

[18.09 backport] Have parser error on dockerfiles without instructions
  • Loading branch information
tonistiigi authored Apr 20, 2019
2 parents ed4da8b + 045e3a2 commit 05766c5
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
5 changes: 5 additions & 0 deletions frontend/dockerfile/parser/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,11 @@ func Parse(rwc io.Reader) (*Result, error) {
if len(warnings) > 0 {
warnings = append(warnings, "[WARNING]: Empty continuation lines will become errors in a future release.")
}

if root.StartLine < 0 {
return nil, errors.New("file with no instructions.")
}

return &Result{
AST: root,
Warnings: warnings,
Expand Down
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Hello
# These are just comments

0 comments on commit 05766c5

Please sign in to comment.