Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix docker build flag (#1191) #1192

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 14 additions & 13 deletions docs/src/internal-build.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,44 +3,45 @@
- When building the runtime we must use Ubuntu 22.04 docker image
- When making an IRD reservation use `--docker-image
yyz-gitlab.local.tenstorrent.com:5005/tenstorrent/infra/ird-ubuntu-22-04-amd64:latest`
- You'll have to manaully install a newer version of cmake, at least 3.22, the easiest way to do this is to `pip install cmake` and make sure this one is in your path
- You'll have to manually install a newer version of cmake, at least 3.22, the easiest way to do this is to `pip install cmake` and make sure this one is in your path
- You'll want LLVM installation to persist IRD reservations, you can achieve this by:
- mkdir /localdev/$USER/ttmlir-toolchain
- When requesting an IRD use `--volumes /localdev/$USER/ttmlir-toolchain:/opt/ttmlir-toolchain`

## Working with Docker Images

Components:
- Dockerfile
- Workflow for building Docker image
- Project build using Docker image

- Dockerfile
- Workflow for building Docker image
- Project build using Docker image

### Overview

We use docker images to prepare project enviroment, install dependancies, tooling and prebuild toolchain.
We use docker images to prepare the project environment, install dependencies, tooling and prebuild toolchain.
Project builds four docker images:

Base image `tt-mlir-base-ubuntu-22-04` [Dockerfile.base](.github/Dockerfile.base)
CI image `tt-mlir-ci-ubuntu-22-04` [Dockerfile.ci](.github/Dockerfile.ci)
Base IRD image `tt-mlir-base-ird-ubuntu-22-04`[Dockerfile.ird](.github/Dockerfile.ird)
IRD image `tt-mlir-ird-ubuntu-22-04` [Dockerfile.ird](.github/Dockerfile.ird)
- Base image `tt-mlir-base-ubuntu-22-04` [Dockerfile.base](.github/Dockerfile.base)
- CI image `tt-mlir-ci-ubuntu-22-04` [Dockerfile.ci](.github/Dockerfile.ci)
- Base IRD image `tt-mlir-base-ird-ubuntu-22-04`[Dockerfile.ird](.github/Dockerfile.ird)
- IRD image `tt-mlir-ird-ubuntu-22-04` [Dockerfile.ird](.github/Dockerfile.ird)

Base image starts with a supported base image (Ubuntu 22.04) and installs dependancies for project build. From there we build CI image that contains prebuild toolcahin and is used in CI to shoten the build time. IRD image contain dev tools like GDB, vim etc and shh and are use in IRD enviroments.
Base image starts with a supported base image (Ubuntu 22.04) and installs dependencies for project build. From there, we build the CI image that contains the prebuild toolchain and is used in CI to shorten the build time. IRD image contains dev tools like GDB, vim etc and ssh which are used in IRD enviroments.

During the CI Docker build, the project is built and tests are run to ensure that everything is set up correctly. If any dependencies are missing, the Docker build will fail.

### Building the Docker Image using GitHub Actions

The GitHub Actions workflow [Build and Publish Docker Image](.github/workflows/build-image.yml) builds the Docker images and uploads them to GitHub Packages at https://github.com/orgs/tenstorrent/packages?repo_name=tt-mlir. We use the git SHA we build from as the tag.
The GitHub Actions workflow [Build and Publish Docker Image](.github/workflows/build-image.yml) builds the Docker images and uploads them to GitHub Packages at [https://github.com/orgs/tenstorrent/packages?repo_name=tt-mlir](https://github.com/orgs/tenstorrent/packages?repo_name=tt-mlir). We use the git SHA we build from as the tag.

### Building the Docker Image Locally

To test the changes and build the image locally, use the following command:
```bash
docker build -f .github/Dockerfile.base -t ghcr.io/tenstorrent/tt-mlir/tt-mlir-base-ubuntu-22-04:latest .
docker build -f .github/Dockerfile.ci -t ghcr.io/tenstorrent/tt-mlir/tt-mlir-ci-ubuntu-22-04:latest .
docker build -f .github/Dockerfile.ird -build-args FROM_IMAGE=base -t ghcr.io/tenstorrent/tt-mlir/tt-mlir-ird-base-ubuntu-22-04:latest .
docker build -f .github/Dockerfile.ird -build-args FROM_IMAGE=ci -t ghcr.io/tenstorrent/tt-mlir/tt-mlir-ird-ubuntu-22-04:latest .
docker build -f .github/Dockerfile.ird --build-arg FROM_IMAGE=base -t ghcr.io/tenstorrent/tt-mlir/tt-mlir-ird-base-ubuntu-22-04:latest .
docker build -f .github/Dockerfile.ird --build-arg FROM_IMAGE=ci -t ghcr.io/tenstorrent/tt-mlir/tt-mlir-ird-ubuntu-22-04:latest .
```

### Using the Image in GitHub Actions Jobs
Expand Down