修改 docker 编译

This commit is contained in:
bjdgyc
2024-01-29 17:47:46 +08:00
parent 4f77fd9013
commit 289f748543
9 changed files with 118 additions and 74 deletions

View File

@@ -8,6 +8,6 @@ var (
// APP_VER app版本号
APP_VER = "0.0.1"
// 提交id
CommitId string
Date string
CommitId string
BuildDate string
)

View File

@@ -57,7 +57,7 @@ func execute() {
envs[rr.Key().String()] = rr.Value().Index(0).String()
}
//移动配置解析代码
// 移动配置解析代码
conf := linkViper.GetString("conf")
linkViper.SetConfigFile(conf)
err = linkViper.ReadInConfig()
@@ -113,27 +113,27 @@ func initCmd() {
cobra.OnInitialize(func() {
linkViper.AutomaticEnv()
//ver := linkViper.GetBool("version")
//if ver {
// ver := linkViper.GetBool("version")
// if ver {
// printVersion()
// os.Exit(0)
//}
// }
//
//return
// return
//
//conf := linkViper.GetString("conf")
//_, err := os.Stat(conf)
//if errors.Is(err, os.ErrNotExist) {
// conf := linkViper.GetString("conf")
// _, err := os.Stat(conf)
// if errors.Is(err, os.ErrNotExist) {
// // 没有配置文件,不做处理
// panic("conf stat err:" + err.Error())
//}
// }
//
//
//linkViper.SetConfigFile(conf)
//err = linkViper.ReadInConfig()
//if err != nil {
// linkViper.SetConfigFile(conf)
// err = linkViper.ReadInConfig()
// if err != nil {
// panic("config file err:" + err.Error())
//}
// }
})
}
@@ -179,6 +179,6 @@ func initToolCmd() *cobra.Command {
}
func printVersion() {
fmt.Printf("%s v%s build on %s [%s, %s] %s commit_id(%s)\n",
APP_NAME, APP_VER, runtime.Version(), runtime.GOOS, runtime.GOARCH, Date, CommitId)
fmt.Printf("%s v%s build on %s [%s, %s] BuildDate:%s commit_id(%s)\n",
APP_NAME, APP_VER, runtime.Version(), runtime.GOOS, runtime.GOARCH, BuildDate, CommitId)
}

View File

@@ -21,16 +21,16 @@ var uiData embed.FS
// 程序版本
var (
appVer string
commitId string
date string
appVer string
commitId string
buildDate string
)
func main() {
admin.UiData = uiData
base.APP_VER = appVer
base.CommitId = commitId
base.Date = date
base.BuildDate = buildDate
base.Start()
handler.Start()