27 lines
559 B
Go
27 lines
559 B
Go
package golang
|
|
|
|
import (
|
|
_ "embed"
|
|
|
|
"git.icechen.cn/pkg/wujian_develop_tool/config"
|
|
|
|
"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
|
|
|
|
func GenDockerfile(service config.Service) error {
|
|
color.Green("正在生成dockerfile...")
|
|
err := util.TemplateToFile(service.Root+"/Dockerfile", dockerfileTemplate, service)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
return util.TemplateToFile(service.Root+"/main.go", mainGoTemplate, nil)
|
|
}
|