wujian_develop_tool/template/service/docker/golang/golang.go

27 lines
559 B
Go
Raw Normal View History

2022-01-06 23:34:37 +08:00
package golang
import (
_ "embed"
2022-01-10 20:26:14 +08:00
"git.icechen.cn/pkg/wujian_develop_tool/config"
2022-01-06 23:34:37 +08:00
"github.com/fatih/color"
"git.icechen.cn/pkg/wujian_develop_tool/util"
)
//go:embed "Dockerfile.tpl"
var dockerfileTemplate string
//go:embed "main.tpl"
var mainGoTemplate string
2022-01-10 20:26:14 +08:00
func GenDockerfile(service config.Service) error {
2022-01-06 23:34:37 +08:00
color.Green("正在生成dockerfile...")
2022-01-10 20:26:14 +08:00
err := util.TemplateToFile(service.Root+"/Dockerfile", dockerfileTemplate, service)
2022-01-06 23:34:37 +08:00
if err != nil {
return err
}
2022-01-10 20:26:14 +08:00
return util.TemplateToFile(service.Root+"/main.go", mainGoTemplate, nil)
2022-01-06 23:34:37 +08:00
}