|
@@ -7,11 +7,11 @@ import (
|
|
"path/filepath"
|
|
"path/filepath"
|
|
"strings"
|
|
"strings"
|
|
"text/template"
|
|
"text/template"
|
|
- "time"
|
|
|
|
|
|
|
|
"github.com/logrusorgru/aurora"
|
|
"github.com/logrusorgru/aurora"
|
|
"github.com/spf13/cobra"
|
|
"github.com/spf13/cobra"
|
|
"github.com/zeromicro/go-zero/tools/goctl/util"
|
|
"github.com/zeromicro/go-zero/tools/goctl/util"
|
|
|
|
+ "github.com/zeromicro/go-zero/tools/goctl/util/env"
|
|
"github.com/zeromicro/go-zero/tools/goctl/util/pathx"
|
|
"github.com/zeromicro/go-zero/tools/goctl/util/pathx"
|
|
)
|
|
)
|
|
|
|
|
|
@@ -19,7 +19,6 @@ const (
|
|
dockerfileName = "Dockerfile"
|
|
dockerfileName = "Dockerfile"
|
|
etcDir = "etc"
|
|
etcDir = "etc"
|
|
yamlEtx = ".yaml"
|
|
yamlEtx = ".yaml"
|
|
- cstOffset = 60 * 60 * 8 // 8 hours offset for Chinese Standard Time
|
|
|
|
)
|
|
)
|
|
|
|
|
|
// Docker describes a dockerfile
|
|
// Docker describes a dockerfile
|
|
@@ -152,10 +151,9 @@ func generateDockerfile(goFile, base string, port int, version, timezone string,
|
|
builder.WriteString(`, "` + arg + `"`)
|
|
builder.WriteString(`, "` + arg + `"`)
|
|
}
|
|
}
|
|
|
|
|
|
- _, offset := time.Now().Zone()
|
|
|
|
t := template.Must(template.New("dockerfile").Parse(text))
|
|
t := template.Must(template.New("dockerfile").Parse(text))
|
|
return t.Execute(out, Docker{
|
|
return t.Execute(out, Docker{
|
|
- Chinese: offset == cstOffset,
|
|
|
|
|
|
+ Chinese: env.InChina(),
|
|
GoRelPath: projPath,
|
|
GoRelPath: projPath,
|
|
GoFile: goFile,
|
|
GoFile: goFile,
|
|
ExeFile: pathx.FileNameWithoutExt(filepath.Base(goFile)),
|
|
ExeFile: pathx.FileNameWithoutExt(filepath.Base(goFile)),
|