-
Notifications
You must be signed in to change notification settings - Fork 129
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add custom-container local start #1066
Conversation
91b03aa
to
a00f08c
Compare
src/lib/docker-opts.js
Outdated
return opts; | ||
} | ||
|
||
async function generateLocalStartOpts(runtime, name, mounts, cmd, debugPort, envs, dockerUser, imageName, debugIde, caPort=9000) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这两个重载的函数逻辑大部分相同, 不能合成一个函数?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
generateCustomContainerLocalStartOpts 和 generateLocalStartOpts 这两个函数逻辑还是有所不一样的,如果合成一个函数,需要一些 if...else 去进行判断,代码可读性会下降,同时函数参数上会出现一些冗余,这些冗余会让这个函数在调用时的可理解性下降,因此这里是分为两个函数去写的。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
src/lib/docker-opts.js
Outdated
Mounts: mounts | ||
} | ||
}; | ||
if (runtime === 'custom-container') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
custom-container 能不能定义成一个全局的 const 的变量, fun这个工程应该有 const 全局变量文件吧
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
src/lib/local/api-invoke.js
Outdated
@@ -19,22 +20,16 @@ class ApiInvoke extends Invoke { | |||
await super.init(); | |||
|
|||
this.envs = await docker.generateDockerEnvs(this.baseDir, this.serviceName, this.serviceRes.Properties, this.functionName, this.functionProps, this.debugPort, null, this.nasConfig, true, this.debugIde, this.debugArgs); | |||
this.cmd = docker.generateDockerCmd(this.functionProps, true); | |||
if (this.runtime === 'custom-container') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
还是一个风格问题, 为什么搞两个函数, generateDockerCmd 和 generateDockerCmdOfCustomContainer
我觉得 generateDockerCmd 一个函数就好, 多加一个 runtime 的参数, custom-container 有不同的处理让 generateDockerCmd这个函数搞定就好
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
43aa79d
to
e7d03aa
Compare
cb9fda8
to
8b652b7
Compare
8b652b7
to
49be133
Compare
增加 custom-container 的 local invoke/start;
custom-container 本地调试启的容器,不更改 PATH 环境变量,该环境变量由用户自定义。