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:
Jack001
2025-10-13 20:42:15 +07:00
committed by GitHub
parent 2b10a6a223
commit b2ebbfce62

View File

@@ -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,