Skip to content

Commit 6e63928

Browse files
adam-rlstainless-app[bot]
authored andcommitted
chore(blueprints): Add build context examples (#694)
1 parent 4936844 commit 6e63928

2 files changed

Lines changed: 34 additions & 0 deletions

File tree

src/runloop_api_client/sdk/async_.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,23 @@ class AsyncBlueprintOps:
216216
... dockerfile="FROM ubuntu:22.04\\nRUN apt-get update",
217217
... )
218218
>>> blueprints = await runloop.blueprint.list()
219+
220+
To use a local directory as a build context, use an object.
221+
222+
Example:
223+
>>> from datetime import timedelta
224+
>>> from runloop_api_client.types.blueprint_build_parameters import BuildContext
225+
>>>
226+
>>> runloop = AsyncRunloopSDK()
227+
>>> obj = await runloop.object_storage.upload_from_dir(
228+
... "./",
229+
... ttl=timedelta(hours=1),
230+
... )
231+
>>> blueprint = await runloop.blueprint.create(
232+
... name="my-blueprint",
233+
... dockerfile="FROM ubuntu:22.04\\nCOPY . .\\n",
234+
... build_context=BuildContext(type="object", object_id=obj.id),
235+
... )
219236
"""
220237

221238
def __init__(self, client: AsyncRunloop) -> None:

src/runloop_api_client/sdk/sync.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,23 @@ class BlueprintOps:
215215
... name="my-blueprint", dockerfile="FROM ubuntu:22.04\\nRUN apt-get update"
216216
... )
217217
>>> blueprints = runloop.blueprint.list()
218+
219+
To use a local directory as a build context, use an object.
220+
221+
Example:
222+
>>> from datetime import timedelta
223+
>>> from runloop_api_client.types.blueprint_build_parameters import BuildContext
224+
>>>
225+
>>> runloop = RunloopSDK()
226+
>>> obj = runloop.object_storage.upload_from_dir(
227+
... "./",
228+
... ttl=timedelta(hours=1),
229+
... )
230+
>>> blueprint = runloop.blueprint.create(
231+
... name="my-blueprint",
232+
... dockerfile="FROM ubuntu:22.04\\nCOPY . .\\n",
233+
... build_context=BuildContext(type="object", object_id=obj.id),
234+
... )
218235
"""
219236

220237
def __init__(self, client: Runloop) -> None:

0 commit comments

Comments
 (0)