|
@@ -2,6 +2,7 @@ package docker
|
|
|
|
|
|
import (
|
|
|
"encoding/json"
|
|
|
+ "errors"
|
|
|
"fmt"
|
|
|
"github.com/dotcloud/docker/archive"
|
|
|
"github.com/dotcloud/docker/auth"
|
|
@@ -16,6 +17,10 @@ import (
|
|
|
"strings"
|
|
|
)
|
|
|
|
|
|
+var (
|
|
|
+ ErrDockerfileEmpty = errors.New("Dockerfile cannot be empty")
|
|
|
+)
|
|
|
+
|
|
|
type BuildFile interface {
|
|
|
Build(io.Reader) (string, error)
|
|
|
CmdFrom(string) error
|
|
@@ -529,6 +534,9 @@ func (b *buildFile) Build(context io.Reader) (string, error) {
|
|
|
if err != nil {
|
|
|
return "", err
|
|
|
}
|
|
|
+ if len(fileBytes) == 0 {
|
|
|
+ return "", ErrDockerfileEmpty
|
|
|
+ }
|
|
|
dockerfile := string(fileBytes)
|
|
|
dockerfile = lineContinuation.ReplaceAllString(dockerfile, "")
|
|
|
stepN := 0
|