|
@@ -101,6 +101,7 @@ func (b *buildFile) CmdRun(args string) error {
|
|
if cache, err := b.srv.ImageGetCached(b.image, b.config); err != nil {
|
|
if cache, err := b.srv.ImageGetCached(b.image, b.config); err != nil {
|
|
return err
|
|
return err
|
|
} else if cache != nil {
|
|
} else if cache != nil {
|
|
|
|
+ fmt.Fprintf(b.out, " ---> Using cache\n")
|
|
utils.Debugf("[BUILDER] Use cached version")
|
|
utils.Debugf("[BUILDER] Use cached version")
|
|
b.image = cache.ID
|
|
b.image = cache.ID
|
|
return nil
|
|
return nil
|
|
@@ -185,6 +186,7 @@ func (b *buildFile) CmdAdd(args string) error {
|
|
return err
|
|
return err
|
|
}
|
|
}
|
|
b.tmpContainers[container.ID] = struct{}{}
|
|
b.tmpContainers[container.ID] = struct{}{}
|
|
|
|
+ fmt.Fprintf(b.out, " ---> Running in %s\n", utils.TruncateID(container.ID))
|
|
|
|
|
|
if err := container.EnsureMounted(); err != nil {
|
|
if err := container.EnsureMounted(); err != nil {
|
|
return err
|
|
return err
|
|
@@ -235,6 +237,7 @@ func (b *buildFile) run() (string, error) {
|
|
return "", err
|
|
return "", err
|
|
}
|
|
}
|
|
b.tmpContainers[c.ID] = struct{}{}
|
|
b.tmpContainers[c.ID] = struct{}{}
|
|
|
|
+ fmt.Fprintf(b.out, " ---> Running in %s\n", utils.TruncateID(c.ID))
|
|
|
|
|
|
//start the container
|
|
//start the container
|
|
if err := c.Start(); err != nil {
|
|
if err := c.Start(); err != nil {
|
|
@@ -261,6 +264,7 @@ func (b *buildFile) commit(id string, autoCmd []string, comment string) error {
|
|
if cache, err := b.srv.ImageGetCached(b.image, b.config); err != nil {
|
|
if cache, err := b.srv.ImageGetCached(b.image, b.config); err != nil {
|
|
return err
|
|
return err
|
|
} else if cache != nil {
|
|
} else if cache != nil {
|
|
|
|
+ fmt.Fprintf(b.out, " ---> Using cache\n")
|
|
utils.Debugf("[BUILDER] Use cached version")
|
|
utils.Debugf("[BUILDER] Use cached version")
|
|
b.image = cache.ID
|
|
b.image = cache.ID
|
|
return nil
|
|
return nil
|
|
@@ -274,6 +278,7 @@ func (b *buildFile) commit(id string, autoCmd []string, comment string) error {
|
|
return err
|
|
return err
|
|
}
|
|
}
|
|
b.tmpContainers[container.ID] = struct{}{}
|
|
b.tmpContainers[container.ID] = struct{}{}
|
|
|
|
+ fmt.Fprintf(b.out, " ---> Running in %s\n", utils.TruncateID(container.ID))
|
|
|
|
|
|
if err := container.EnsureMounted(); err != nil {
|
|
if err := container.EnsureMounted(); err != nil {
|
|
return err
|
|
return err
|
|
@@ -314,6 +319,7 @@ func (b *buildFile) Build(dockerfile, context io.Reader) (string, error) {
|
|
b.context = name
|
|
b.context = name
|
|
}
|
|
}
|
|
file := bufio.NewReader(dockerfile)
|
|
file := bufio.NewReader(dockerfile)
|
|
|
|
+ stepN := 0
|
|
for {
|
|
for {
|
|
line, err := file.ReadString('\n')
|
|
line, err := file.ReadString('\n')
|
|
if err != nil {
|
|
if err != nil {
|
|
@@ -334,12 +340,13 @@ func (b *buildFile) Build(dockerfile, context io.Reader) (string, error) {
|
|
}
|
|
}
|
|
instruction := strings.ToLower(strings.Trim(tmp[0], " "))
|
|
instruction := strings.ToLower(strings.Trim(tmp[0], " "))
|
|
arguments := strings.Trim(tmp[1], " ")
|
|
arguments := strings.Trim(tmp[1], " ")
|
|
-
|
|
|
|
- fmt.Fprintf(b.out, "%s %s (%s)\n", strings.ToUpper(instruction), arguments, b.image)
|
|
|
|
|
|
+ stepN += 1
|
|
|
|
+ // FIXME: only count known instructions as build steps
|
|
|
|
+ fmt.Fprintf(b.out, "Step %d : %s %s\n", stepN, strings.ToUpper(instruction), arguments)
|
|
|
|
|
|
method, exists := reflect.TypeOf(b).MethodByName("Cmd" + strings.ToUpper(instruction[:1]) + strings.ToLower(instruction[1:]))
|
|
method, exists := reflect.TypeOf(b).MethodByName("Cmd" + strings.ToUpper(instruction[:1]) + strings.ToLower(instruction[1:]))
|
|
if !exists {
|
|
if !exists {
|
|
- fmt.Fprintf(b.out, "Skipping unknown instruction %s\n", strings.ToUpper(instruction))
|
|
|
|
|
|
+ fmt.Fprintf(b.out, "# Skipping unknown instruction %s\n", strings.ToUpper(instruction))
|
|
continue
|
|
continue
|
|
}
|
|
}
|
|
ret := method.Func.Call([]reflect.Value{reflect.ValueOf(b), reflect.ValueOf(arguments)})[0].Interface()
|
|
ret := method.Func.Call([]reflect.Value{reflect.ValueOf(b), reflect.ValueOf(arguments)})[0].Interface()
|
|
@@ -347,10 +354,10 @@ func (b *buildFile) Build(dockerfile, context io.Reader) (string, error) {
|
|
return "", ret.(error)
|
|
return "", ret.(error)
|
|
}
|
|
}
|
|
|
|
|
|
- fmt.Fprintf(b.out, "===> %v\n", b.image)
|
|
|
|
|
|
+ fmt.Fprintf(b.out, " ---> %v\n", utils.TruncateID(b.image))
|
|
}
|
|
}
|
|
if b.image != "" {
|
|
if b.image != "" {
|
|
- fmt.Fprintf(b.out, "Build successful.\n===> %s\n", b.image)
|
|
|
|
|
|
+ fmt.Fprintf(b.out, "Successfully built %s\n", utils.TruncateID(b.image))
|
|
return b.image, nil
|
|
return b.image, nil
|
|
}
|
|
}
|
|
return "", fmt.Errorf("An error occured during the build\n")
|
|
return "", fmt.Errorf("An error occured during the build\n")
|