mirror of
https://github.com/zeromicro/go-zero.git
synced 2026-05-11 00:40:00 +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
|
base := varStringBase
|
||||||
port := varIntPort
|
port := varIntPort
|
||||||
|
etcDir := filepath.Join(filepath.Dir(goFile), etcDir)
|
||||||
if _, err := os.Stat(etcDir); os.IsNotExist(err) {
|
if _, err := os.Stat(etcDir); os.IsNotExist(err) {
|
||||||
return generateDockerfile(goFile, base, port, version, timezone)
|
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))
|
t := template.Must(template.New("dockerfile").Parse(text))
|
||||||
return t.Execute(out, Docker{
|
return t.Execute(out, Docker{
|
||||||
Chinese: env.InChina(),
|
Chinese: env.InChina(),
|
||||||
GoMainFrom: path.Join(projPath, goFile),
|
GoMainFrom: path.Join(projPath, filepath.Base(goFile)),
|
||||||
GoRelPath: projPath,
|
GoRelPath: projPath,
|
||||||
GoFile: goFile,
|
GoFile: goFile,
|
||||||
ExeFile: exeName,
|
ExeFile: exeName,
|
||||||
|
|||||||
Reference in New Issue
Block a user