diff --git a/README.md b/README.md index 0262cfc..7f3a07e 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,7 @@ Image name | Description | Source Dockerfile ---------- | ----------- | ----------------- `iree-org/amdgpu_ubuntu_jammy_x86_64` | Ubuntu with AMDGPU deps | [Source](./dockerfiles/amdgpu_ubuntu_jammy_x86_64.Dockerfile) `iree-org/amdgpu_ubuntu_jammy_ghr_x86_64` | Ubuntu with AMDGPU deps (GitHub runner) | [Source](./dockerfiles/amdgpu_ubuntu_jammy_ghr_x86_64.Dockerfile) +`iree-org/cpubuilder_ubuntu_ghr_x86_64` | CPU builder with IREE build deps | [Source](./dockerfiles/cpubuilder_ubuntu_jammy_x86_64.Dockerfile) `iree-org/cpubuilder_ubuntu_jammy_ghr_x86_64` | CPU builder with IREE build deps (GitHub runner) | [Source](./dockerfiles/cpubuilder_ubuntu_jammy_ghr_x86_64.Dockerfile) `iree-org/manylinux_x86_64` | Portable Linux release builder for Python packaging | [Source](./dockerfiles/manylinux_x86_64.Dockerfile) `iree-org/manylinux_ghr_x86_64` | Portable Linux release builder for Python packaging (GitHub runner) | [Source](./dockerfiles/manylinux_ghr_x86_64.Dockerfile) @@ -33,12 +34,21 @@ can be referenced using tags or hashes: To build locally, use a command like: -``` +```bash sudo docker buildx build --file dockerfiles/some.Dockerfile . ``` This will print a SHA image id, which you can run with: -``` +```bash sudo docker run --rm -it --entrypoint /bin/bash <> ``` + +You can also +[tag an image](https://docs.docker.com/get-started/docker-concepts/building-images/build-tag-and-publish-an-image/) +to avoid needing to copy the SHA each time: + +```bash +sudo docker buildx build --file dockerfiles/cpubuilder_ubuntu_jammy_x86_64.Dockerfile . --tag cpubuilder:latest +sudo docker run --rm --mount type=bind,source="realpath(~/iree)",target=/iree -it --entrypoint bash cpubuilder:latest +``` diff --git a/dockerfiles/cpubuilder_ubuntu_jammy_ghr_x86_64.Dockerfile b/dockerfiles/cpubuilder_ubuntu_jammy_ghr_x86_64.Dockerfile index ee68657..011e593 100644 --- a/dockerfiles/cpubuilder_ubuntu_jammy_ghr_x86_64.Dockerfile +++ b/dockerfiles/cpubuilder_ubuntu_jammy_ghr_x86_64.Dockerfile @@ -1,23 +1,27 @@ # GitHub Actions Runner with IREE build deps. FROM docker.io/myoung34/github-runner:ubuntu-jammy -######## Basic apt packages ######## +######## Apt packages ######## RUN apt update && \ - apt install -y \ - wget git unzip curl gnupg2 lsb-release && \ - apt install -y \ - ccache clang-14 lld-14 libssl-dev ninja-build libxml2-dev llvm-dev pkg-config \ - libcapstone-dev libtbb-dev libzstd-dev -# Python + apt install -y wget git unzip curl gnupg2 lsb-release +# Python 3. RUN apt install -y python3.11-dev python3.11-venv python3-pip && \ update-alternatives --install /usr/local/bin/python python /usr/bin/python3.11 3 && \ update-alternatives --install /usr/local/bin/python3 python3 /usr/bin/python3.11 3 -# Toolchains and build deps +# Toolchains and build dependencies. RUN apt install -y \ - ccache ninja-build clang-14 lld-14 gcc-9 g++-9 \ - libssl-dev libxml2-dev libcapstone-dev libtbb-dev libzstd-dev \ - llvm-dev pkg-config -# Cleanup + clang-14 lld-14 \ + gcc-9 g++-9 \ + ccache ninja-build libssl-dev libxml2-dev libcapstone-dev libtbb-dev \ + libzstd-dev llvm-dev pkg-config +# Recent compiler tools for build configurations like ASan/TSan. +# * See https://apt.llvm.org/ for context on the apt commands. +ARG LLVM_VERSION=19 +RUN echo "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-${LLVM_VERSION} main" >> /etc/apt/sources.list && \ + curl https://apt.llvm.org/llvm-snapshot.gpg.key | gpg --dearmor > /etc/apt/trusted.gpg.d/llvm-snapshot.gpg && \ + apt update && \ + apt install -y clang-${LLVM_VERSION} lld-${LLVM_VERSION} +# Cleanup. RUN apt clean && rm -rf /var/lib/apt/lists/* ######## CMake ######## @@ -27,12 +31,12 @@ COPY build_tools/install_cmake.sh ./ RUN ./install_cmake.sh "${CMAKE_VERSION}" && rm -rf /install-cmake ######## Build toolchain configuration ######## -# Setup symlinks and alternatives. +# Setup symlinks and alternatives then default to using clang-14. +# This can be overriden to gcc or another clang version as needed. RUN ln -s /usr/bin/lld-14 /usr/bin/lld && \ ln -s /usr/bin/ld.lld-14 /usr/bin/ld.lld && \ ln -s /usr/bin/clang-14 /usr/bin/clang && \ ln -s /usr/bin/clang++-14 /usr/bin/clang++ -# Default to using clang. This can be overriden to gcc as desired. ENV CC=clang ENV CXX=clang++ diff --git a/dockerfiles/cpubuilder_ubuntu_jammy_x86_64.Dockerfile b/dockerfiles/cpubuilder_ubuntu_jammy_x86_64.Dockerfile index 7cb78d5..7b7e004 100644 --- a/dockerfiles/cpubuilder_ubuntu_jammy_x86_64.Dockerfile +++ b/dockerfiles/cpubuilder_ubuntu_jammy_x86_64.Dockerfile @@ -1,23 +1,27 @@ -# Stock Ubuntu with IREE build deps. +# Stock Ubuntu Jammy (22.04) with IREE build dependencies. FROM ubuntu:jammy -######## Basic apt packages ######## +######## Apt packages ######## RUN apt update && \ - apt install -y \ - wget git unzip curl gnupg2 lsb-release && \ - apt install -y \ - ccache clang-14 lld-14 libssl-dev ninja-build libxml2-dev llvm-dev pkg-config \ - libcapstone-dev libtbb-dev libzstd-dev -# Python + apt install -y wget git unzip curl gnupg2 lsb-release +# Python 3. RUN apt install -y python3.11-dev python3.11-venv python3-pip && \ update-alternatives --install /usr/local/bin/python python /usr/bin/python3.11 3 && \ update-alternatives --install /usr/local/bin/python3 python3 /usr/bin/python3.11 3 -# Toolchains and build deps +# Toolchains and build dependencies. RUN apt install -y \ - ccache ninja-build clang-14 lld-14 gcc-9 g++-9 \ - libssl-dev libxml2-dev libcapstone-dev libtbb-dev libzstd-dev \ - llvm-dev pkg-config -# Cleanup + clang-14 lld-14 \ + gcc-9 g++-9 \ + ccache ninja-build libssl-dev libxml2-dev libcapstone-dev libtbb-dev \ + libzstd-dev llvm-dev pkg-config +# Recent compiler tools for build configurations like ASan/TSan. +# * See https://apt.llvm.org/ for context on the apt commands. +ARG LLVM_VERSION=19 +RUN echo "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-${LLVM_VERSION} main" >> /etc/apt/sources.list && \ + curl https://apt.llvm.org/llvm-snapshot.gpg.key | gpg --dearmor > /etc/apt/trusted.gpg.d/llvm-snapshot.gpg && \ + apt update && \ + apt install -y clang-${LLVM_VERSION} lld-${LLVM_VERSION} +# Cleanup. RUN apt clean && rm -rf /var/lib/apt/lists/* ######## CMake ######## @@ -27,12 +31,12 @@ COPY build_tools/install_cmake.sh ./ RUN ./install_cmake.sh "${CMAKE_VERSION}" && rm -rf /install-cmake ######## Build toolchain configuration ######## -# Setup symlinks and alternatives. +# Setup symlinks and alternatives then default to using clang-14. +# This can be overriden to gcc or another clang version as needed. RUN ln -s /usr/bin/lld-14 /usr/bin/lld && \ ln -s /usr/bin/ld.lld-14 /usr/bin/ld.lld && \ ln -s /usr/bin/clang-14 /usr/bin/clang && \ ln -s /usr/bin/clang++-14 /usr/bin/clang++ -# Default to using clang. This can be overriden to gcc as desired. ENV CC=clang ENV CXX=clang++