This repository has been archived on 2024-04-08. You can view files and clone it, but cannot push or open issues or pull requests.
dagger/docs/core-concepts/1205-container-images.md
Helder Correia a48d093fb8
Add documentation for building container images
Signed-off-by: Helder Correia <174525+helderco@users.noreply.github.com>
2022-03-09 16:10:17 -01:00

1.3 KiB

slug displayed_sidebar
/1205/container-images europa

Building container images

You can use Dagger to build container images. Here's a simple example of a Dockerfile build:

Building with CUE

Dockerfile files are easy to start, but you can also build images entirely in CUE. The following example produces the same image as above:

Automation

Building images in CUE gives you greater flexibility. For example, you can automate building multiple versions of an image, and deploy, all in Dagger:

Now you can deploy all versions:

dagger do versions

Or just build a specific version, without pushing:

dagger do versions 8.0 build

Multi-stage build

Another common pattern is multi-stage builds. This allows you to have heavier build images during the build process, and copy the built artifacts into a cleaner and lighter image to run in production.