Back to Dagger

Copy File Runtime

docs/current_docs/partials/cookbook/filesystems/_copy-file-runtime.mdx

0.20.71.4 KB
Original Source

Copy a file to the Dagger module runtime container for custom processing

The following Dagger Function accepts a File argument and copies the specified file to the Dagger module runtime container. This makes it possible to add one or more files to the runtime container and manipulate them using custom logic.

<Tabs groupId="language" queryString="sdk"> <TabItem value="go" label="Go">
go
</TabItem> <TabItem value="python" label="Python">
python
</TabItem> <TabItem value="typescript" label="TypeScript">
typescript
</TabItem> <TabItem value="php" label="PHP">
php
</TabItem> </Tabs>

Examples

Copy the data.json host file to the runtime container and process it:

<Tabs groupId="shell">
<TabItem value="System shell">
```shell
dagger -c 'copy-file ../data.json'
```
</TabItem>
<TabItem value="Dagger Shell">
```shell title="First type 'dagger' for interactive mode."
copy-file ../data.json
```
</TabItem>
<TabItem value="Dagger CLI">
```shell
dagger call copy-file --source=../data.json
```
</TabItem>
</Tabs>