Skip to content

Commit

Permalink
Merge pull request #771 from LinuxMercedes/error-on-empty-dockerfile
Browse files Browse the repository at this point in the history
Have parser error on dockerfiles without instructions
  • Loading branch information
tonistiigi authored Jan 5, 2019
2 parents 03a86f1 + 2ec7d53 commit 34ff9c2
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 34ff9c2

Please sign in to comment.