Back to Dagger

Image From Dockerfile

docs/current_docs/partials/cookbook/builds/_image-from-dockerfile.mdx

0.20.71.2 KB
Original Source

Build image from Dockerfile

The following Dagger Function builds an image from a Dockerfile.

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

Example

Build and publish an image from an existing Dockerfile

<Tabs groupId="shell"> <TabItem value="System shell"> ```shell dagger -c 'build https://github.com/dockersamples/python-flask-redis' ``` </TabItem> <TabItem value="Dagger Shell"> ```shell title="First type 'dagger' for interactive mode." build https://github.com/dockersamples/python-flask-redis ``` </TabItem> <TabItem value="Dagger CLI"> ```shell dagger call build --src="https://github.com/dockersamples/python-flask-redis" ``` </TabItem> </Tabs>