mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-01-19 08:19:15 +08:00
fix: 解决创建运行环境报错的 BUG (#550)
This commit is contained in:
parent
18c5c99705
commit
0f1107314f
@ -248,7 +248,7 @@ func getContainerNames(install model.AppInstall) ([]string, error) {
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
project, err := composeV2.GetComposeProject(install.Name, install.GetPath(), []byte(install.DockerCompose), []byte(envStr))
|
||||
project, err := composeV2.GetComposeProject(install.Name, install.GetPath(), []byte(install.DockerCompose), []byte(envStr), true)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -400,7 +400,7 @@ func getServiceFromInstall(appInstall model.AppInstall) (service *composeV2.Comp
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
project, err = composeV2.GetComposeProject(appInstall.Name, appInstall.GetPath(), []byte(appInstall.DockerCompose), []byte(envStr))
|
||||
project, err = composeV2.GetComposeProject(appInstall.Name, appInstall.GetPath(), []byte(appInstall.DockerCompose), []byte(envStr), true)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
@ -90,7 +90,7 @@ func (r *RuntimeService) Create(create request.RuntimeCreate) (err error) {
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
composeService, err := getComposeService(create.Name, newNameDir, composeContent, envContent)
|
||||
composeService, err := getComposeService(create.Name, newNameDir, composeContent, envContent, false)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
@ -239,7 +239,7 @@ func (r *RuntimeService) Update(req request.RuntimeUpdate) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
composeService, err := getComposeService(runtime.Name, runtimeDir, composeContent, envContent)
|
||||
composeService, err := getComposeService(runtime.Name, runtimeDir, composeContent, envContent, false)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -65,8 +65,8 @@ func handleParams(image, runtimeType, runtimeDir string, params map[string]inter
|
||||
return
|
||||
}
|
||||
|
||||
func getComposeService(name, runtimeDir string, composeFile, env []byte) (*docker.ComposeService, error) {
|
||||
project, err := docker.GetComposeProject(name, runtimeDir, composeFile, env)
|
||||
func getComposeService(name, runtimeDir string, composeFile, env []byte, skipNormalization bool) (*docker.ComposeService, error) {
|
||||
project, err := docker.GetComposeProject(name, runtimeDir, composeFile, env, skipNormalization)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -88,7 +88,7 @@ func (s *ComposeService) ComposeBuild() error {
|
||||
return s.Build(context.Background(), s.project, api.BuildOptions{})
|
||||
}
|
||||
|
||||
func GetComposeProject(projectName, workDir string, yml []byte, env []byte) (*types.Project, error) {
|
||||
func GetComposeProject(projectName, workDir string, yml []byte, env []byte, skipNormalization bool) (*types.Project, error) {
|
||||
var configFiles []types.ConfigFile
|
||||
configFiles = append(configFiles, types.ConfigFile{
|
||||
Filename: "docker-compose.yml",
|
||||
@ -106,7 +106,7 @@ func GetComposeProject(projectName, workDir string, yml []byte, env []byte) (*ty
|
||||
project, err := loader.Load(details, func(options *loader.Options) {
|
||||
options.SetProjectName(projectName, true)
|
||||
options.ResolvePaths = true
|
||||
options.SkipNormalization = true
|
||||
options.SkipNormalization = skipNormalization
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
Loading…
x
Reference in New Issue
Block a user