开始模板构建
/sandbox/v1/templates/{templateID}/builds/{buildID}◐ 部分支持请求参数
templateIDstring必填path: Template identifier from templates.create or templates.list. Use your organization's templateID, not a provider handle.
buildIDstring必填path: Build identifier returned by templates.create. It must belong to the selected template in your organization.
fromImagestring可选Image to use as a base for the template build
fromTemplatestring可选Template to use as a base for the template build
fromImageRegistryobject可选Registry authentication. Unlike E2B, only the vault reference variant is accepted; plaintext aws, gcp and registry variants return 400. Cannot be used with official templates.
展开子字段 (4)
typestring必填vault resolves the password at build time without persisting its value.
vaultIdstring必填Vault ID containing the registry password, from vaults.list or vaults.create.
secretNamestring必填Secret name in that vault containing the registry password.
usernamestring可选Registry login username without whitespace; defaults to token.
forceboolean可选Whether the whole build should be forced to run regardless of the cache
stepsarray可选List of steps to execute in the template build
展开子字段 (4)
typestring必填Type of the step
argsarray可选Arguments for the step
filesHashstring可选Hash of the files used in the step
forceboolean可选Whether the step should be forced to run regardless of the cache
startCmdstring可选Start command to execute in the template after the build
readyCmdstring可选Ready check command to execute in the template after the build
dockerfilestring可选Dockerfile text, at most 64 KiB UTF-8. Mutually exclusive with fromImage, fromTemplate and steps. COPY/ADD are rejected; fetch remote content using RUN. Registry credentials require a nonofficial image in the first FROM.
返回
202
错误按 E2B 格式返回,参见 错误码
请求示例
curl
curl https://api.deepraxis.com/sandbox/v1/templates/sbe_example/builds/sbt_example \
-H "X-API-Key: $PRAXIS_API_KEY" \
-H "Content-Type: application/json" \
-d '{"dockerfile":"FROM praxis/base\nRUN echo template-reference"}'Python
import requests
api_key = "$PRAXIS_API_KEY"
# templateID and buildID come from the preceding create response; replace the example IDs.
resp = requests.request("POST", "https://api.deepraxis.com/sandbox/v1/templates/sbe_example/builds/sbt_example",
headers={"X-API-Key": api_key},
json={"dockerfile":"FROM praxis/base\nRUN echo template-reference"},
)
print(resp.status_code, resp.text)TypeScript
const apiKey = "$PRAXIS_API_KEY";
// templateID and buildID come from the preceding create response; replace the example IDs.
const resp = await fetch("https://api.deepraxis.com/sandbox/v1/templates/sbe_example/builds/sbt_example", { method: "POST",
headers: { "X-API-Key": apiKey, "Content-Type": "application/json" },
body: JSON.stringify({"dockerfile":"FROM praxis/base\nRUN echo template-reference"}),
});
console.log(resp.status, await resp.text());响应示例 202
{}响应
HTTP 202
The build has started
未声明响应体。