mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-11-11 04:00:56 +08:00
fix: 解决安装应用时候,原始 docker-compose.yml 的 deploy 字段下内容会被自动覆写的问题 (#4512)
Refs https://github.com/1Panel-dev/1Panel/issues/4340
This commit is contained in:
parent
43a6b4b735
commit
c77742e72e
1 changed files with 8 additions and 6 deletions
|
|
@ -1229,16 +1229,18 @@ func addDockerComposeCommonParam(composeMap map[string]interface{}, serviceName
|
||||||
serviceValue := service.(map[string]interface{})
|
serviceValue := service.(map[string]interface{})
|
||||||
|
|
||||||
deploy := map[string]interface{}{}
|
deploy := map[string]interface{}{}
|
||||||
|
|
||||||
if de, ok := serviceValue["deploy"]; ok {
|
if de, ok := serviceValue["deploy"]; ok {
|
||||||
deploy = de.(map[string]interface{})
|
deploy = de.(map[string]interface{})
|
||||||
}
|
}
|
||||||
deploy["resources"] = map[string]interface{}{
|
resource := map[string]interface{}{}
|
||||||
"limits": map[string]interface{}{
|
if res, ok := deploy["resources"]; ok {
|
||||||
|
resource = res.(map[string]interface{})
|
||||||
|
}
|
||||||
|
resource["limits"] = map[string]interface{}{
|
||||||
"cpus": "${CPUS}",
|
"cpus": "${CPUS}",
|
||||||
"memory": "${MEMORY_LIMIT}",
|
"memory": "${MEMORY_LIMIT}",
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
deploy["resources"] = resource
|
||||||
serviceValue["deploy"] = deploy
|
serviceValue["deploy"] = deploy
|
||||||
|
|
||||||
ports, ok := serviceValue["ports"].([]interface{})
|
ports, ok := serviceValue["ports"].([]interface{})
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue