Back to Dagger

Multi Arch Cross Compilation

docs/current_docs/partials/cookbook/builds/_multi-arch-cross-compilation.mdx

0.20.71.3 KB
Original Source

Build multi-arch image with cross-compliation

The following Dagger Function builds a single image for different CPU architectures using cross-compilation.

:::info This Dagger Function uses the containerd utility module. To run it locally install the module first with dagger install github.com/levlaz/daggerverse/[email protected] :::

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

Example

Build and publish a multi-platform image with cross compliation:

<Tabs groupId="shell"> <TabItem value="System shell"> ```shell dagger -c 'build https://github.com/golang/example#master:hello' ``` </TabItem> <TabItem value="Dagger Shell"> ```shell title="First type 'dagger' for interactive mode." build https://github.com/golang/example#master:hello ``` </TabItem> <TabItem value="Dagger CLI"> ```shell dagger call build --src="https://github.com/golang/example#master:hello" ``` </TabItem> </Tabs>