Merge pull request #952 from thaJeztah/18.09_backport_fix_empty_dockerfile

[18.09 backport] Have parser error on dockerfiles without instructions
docker-18.09
Tõnis Tiigi 2019-04-19 17:31:54 -07:00 committed by GitHub
commit 05766c5c21
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 0 deletions

View File

@ -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,

View File

@ -0,0 +1,3 @@
# Hello
# These are just comments