Skip to content

Commit

Permalink
fix: support image command and args
Browse files Browse the repository at this point in the history
  • Loading branch information
yugasun committed Jun 16, 2021
1 parent 0b6aff1 commit d5216bd
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 11 deletions.
16 changes: 10 additions & 6 deletions docs/configure.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ inputs:
namespace: scf_images # 命名空间
repositoryName: nodejs_server # 镜像名称
tagName: latest # 镜像版本
command: node index.js # 容器启动命名
args: test # 容器启动参数
events: # 触发器
- timer: # 定时触发器
parameters:
Expand Down Expand Up @@ -498,12 +500,14 @@ value:

镜像相关配置:

| 参数名称 | 必选 | 类型 | 默认值 | 描述 |
| -------------- | ---- | ------ | -------- | :-------------------------------------------- |
| registryName || string | | [容器镜像服务][tcr]名称,使用企业版镜像时必须 |
| namespace || string | | 命名空间 |
| repositoryName || string | | 镜像名称 |
| tagName || string | `latest` | 镜像版本 |
| 参数名称 | 必选 | 类型 | 默认值 | 描述 |
| -------------- | ---- | ------ | -------- | :----------------------------------------------------- |
| registryName || string | | [容器镜像服务][tcr]名称,使用企业版镜像时必须 |
| namespace || string | | 命名空间 |
| repositoryName || string | | 镜像名称 |
| tagName || string | `latest` | 镜像版本 |
| command || string | | 容器启动命令,默认使用镜像中的 `Entrypoint` 或者 `CMD` |
| args || string | | 容器启动参数,默认使用惊醒中的 `CMD` |

<!-- Refer links -->

Expand Down
2 changes: 1 addition & 1 deletion serverless.component.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: scf
version: 0.7.0
version: 0.7.1
author: Tencent Cloud, Inc.
org: Tencent Cloud, Inc.
description: Deploy a serverless cloud function on Tencent Cloud.
Expand Down
2 changes: 1 addition & 1 deletion src/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"dependencies": {
"download": "^8.0.0",
"tencent-component-toolkit": "^2.11.0",
"tencent-component-toolkit": "^2.12.0",
"type": "^2.0.0"
}
}
10 changes: 7 additions & 3 deletions src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,17 +178,21 @@ const formatInputs = async (instance, credentials, appId, inputs) => {
imageCode = {
imageType: imageInfo.imageType,
imageUri: imageInfo.imageUri,
registryId: imageInfo.registryId
registryId: imageInfo.registryId,
command: imageConfig.command,
args: imageConfig.args
}
} else {
const imageInfo = await tcr.getPersonalImageInfoForScf({
const imageInfo = await tcr.getPersonalImageInfo({
namespace: imageConfig.namespace,
repositoryName: imageConfig.repositoryName,
tagName: imageConfig.tagName || 'latest'
})
imageCode = {
imageType: imageInfo.imageType,
imageUri: imageInfo.imageUri
imageUri: imageInfo.imageUri,
command: imageConfig.command,
args: imageConfig.args
}
}
}
Expand Down

0 comments on commit d5216bd

Please sign in to comment.