mirror of
https://github.com/zeromicro/go-zero.git
synced 2026-05-07 15:10:01 +08:00
fix: ensure Dockerfile includes etc directory and correct CMD based on config (#4343)
Co-authored-by: 白少杰macpro <harrellharris68491@gmail.com>
This commit is contained in:
@@ -73,6 +73,7 @@ func dockerCommand(_ *cobra.Command, _ []string) (err error) {
|
||||
|
||||
base := varStringBase
|
||||
port := varIntPort
|
||||
etcDir := filepath.Join(filepath.Dir(goFile), etcDir)
|
||||
if _, err := os.Stat(etcDir); os.IsNotExist(err) {
|
||||
return generateDockerfile(goFile, base, port, version, timezone)
|
||||
}
|
||||
@@ -170,7 +171,7 @@ func generateDockerfile(goFile, base string, port int, version, timezone string,
|
||||
t := template.Must(template.New("dockerfile").Parse(text))
|
||||
return t.Execute(out, Docker{
|
||||
Chinese: env.InChina(),
|
||||
GoMainFrom: path.Join(projPath, goFile),
|
||||
GoMainFrom: path.Join(projPath, filepath.Base(goFile)),
|
||||
GoRelPath: projPath,
|
||||
GoFile: goFile,
|
||||
ExeFile: exeName,
|
||||
|
||||
Reference in New Issue
Block a user