add dockerfile generator

This commit is contained in:
kevin
2020-11-08 21:28:58 +08:00
parent 3806e66cf1
commit 95aa65efb9
4 changed files with 52 additions and 14 deletions

View File

@@ -6,7 +6,6 @@ import (
"text/template"
"github.com/tal-tech/go-zero/tools/goctl/util"
"github.com/tal-tech/go-zero/tools/goctl/vars"
)
func GenerateDockerfile(goFile string, args ...string) error {
@@ -33,10 +32,9 @@ func GenerateDockerfile(goFile string, args ...string) error {
t := template.Must(template.New("dockerfile").Parse(dockerTemplate))
return t.Execute(out, map[string]string{
"projectName": vars.ProjectName,
"goRelPath": projPath,
"goFile": goFile,
"exeFile": util.FileNameWithoutExt(goFile),
"argument": builder.String(),
"goRelPath": projPath,
"goFile": goFile,
"exeFile": util.FileNameWithoutExt(filepath.Base(goFile)),
"argument": builder.String(),
})
}