Browse Source

optimize dockerfile (#272)

Kevin Wan 4 years ago
parent
commit
fd73ced6dc
2 changed files with 4 additions and 4 deletions
  1. 3 1
      tools/goctl/docker/docker.go
  2. 1 3
      tools/goctl/docker/template.go

+ 3 - 1
tools/goctl/docker/docker.go

@@ -9,6 +9,7 @@ import (
 	"text/template"
 	"time"
 
+	"github.com/logrusorgru/aurora"
 	"github.com/tal-tech/go-zero/tools/goctl/util"
 	ctlutil "github.com/tal-tech/go-zero/tools/goctl/util"
 	"github.com/urfave/cli"
@@ -53,7 +54,8 @@ func DockerCommand(c *cli.Context) error {
 
 	projDir, ok := util.FindProjectPath(goFile)
 	if ok {
-		fmt.Printf("Run \"docker build ...\" command in dir %q\n", projDir)
+		fmt.Printf("Hint: run \"docker build ...\" command in dir %q\n", projDir)
+		fmt.Println(aurora.Green("Done."))
 	}
 
 	return nil

+ 1 - 3
tools/goctl/docker/template.go

@@ -28,9 +28,7 @@ RUN go build -ldflags="-s -w" -o /app/{{.ExeFile}} {{.GoRelPath}}/{{.GoFile}}
 
 FROM alpine
 
-RUN apk update --no-cache
-RUN apk add --no-cache ca-certificates
-RUN apk add --no-cache tzdata
+RUN apk update --no-cache && apk add --no-cache ca-certificates tzdata
 ENV TZ Asia/Shanghai
 
 WORKDIR /app