Back to Dagger

Mount Files As Secret

docs/current_docs/partials/cookbook/secrets/_mount-files-as-secret.mdx

0.20.71.1 KB
Original Source

Mount files as secrets

The following Dagger Function accepts a GitHub hosts configuration file as a Secret, and mounts the file as a Secret to a container to authorize a request to GitHub.

<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> </Tabs>

Mounting files

To mount a file as a secret, you can use the following:

<Tabs groupId="shell"> <TabItem value="System shell"> ```shell dagger -c 'github-auth file://$HOME/.config/gh/hosts.yml' ``` </TabItem> <TabItem value="Dagger Shell"> ```shell title="First type 'dagger' for interactive mode." github-auth file://$HOME/.config/gh/hosts.yml ``` </TabItem> <TabItem value="Dagger CLI"> ```shell dagger call github-auth --gh-creds=file://$HOME/.config/gh/hosts.yml ``` </TabItem> </Tabs>