tree: 8849ce48d2c926b3707ab14275f16544e1cb5e96 [path history] [tgz]
  1. android/
  2. base/
  3. emscripten/
  4. frontends/
  5. frontends-nvidia/
  6. frontends-swiftshader/
  7. gradle-android/
  8. manylinux2014_x86_64-release/
  9. nvidia/
  10. riscv/
  11. samples/
  12. swiftshader/
  13. __init__.py
  14. docker_run.sh
  15. gcloud_setup.sh
  16. manage_images.py
  17. prod_digests.txt
  18. README.md
  19. utils.py
build_tools/docker/README.md

IREE Docker Configuration

This directory contains the Dockerfiles that specify the container images used for IREE. Images are uploaded to Google Container Registry (GCR).

Running Images Locally

To build an image, use docker build, e.g.:

docker build build_tools/docker/base --tag base

To explore an image interactively, use docker run, e.g.

docker run --interactive --tty --rm base

You can find more information in the official Docker docs.

Multi-stage Builds

We use multi-stage builds to limit duplication in our Dockerfiles and reduce the final image size. There is still duplication in cases where it's difficult to determine the correct files to copy.

Dependencies Between Images

IREE images follow a consistent structure. The image defined by build_tools/docker/foo-bar/Dockerfile is uploaded to GCR as gcr.io/iree-oss/foo-bar. It may be tagged as latest or prod, e.g. gcr.io/iree-oss/foo-bar:latest. Dockerfile image definitions should list their dependencies based on these image names.

We use a helper python script to manage the Docker image deployment. It lists all images and their dependencies and manages their canonical registry location. This script pushes images to GCR which requires the Storage Admin role in the iree-oss GCP project.

When creating a new image, add it to the mapping in this script. To build an image and all images it depends on as well as pushing them to GCR and updating all references to the image digest.

python3 build_tools/docker/manage_images.py --image base

For multiple images

python3 build_tools/docker/manage_images.py --image base --image nvidia

There is also the special option --image all for all registered images.

python3 build_tools/docker/manage_images.py --image all

Adding or Updating an Image

Part 1. Local Changes

  1. Update the Dockerfile for the image that you want to modify or add. If you're adding a new image, or updating the dependencies between images, be sure to update IMAGES_TO_DEPENDENCIES in manage_images.py as well. If you are adding new images, it is best add them via git add before proceeding.

  2. Build the image, push the image to GCR and update all references to the image with the new GCR digest:

    python3 build_tools/docker/manage_images.py --image "${IMAGE?}"
    
  3. Test that the changes behave as expected locally and iterate on the steps above.

Part 2. Submitting to GitHub

  1. Commit the changes and send a PR for review. The CI will use the updated digest references to test the new images.

  2. Merge your PR after is approved and all CI tests pass.