diff --git a/Dockerfile b/Dockerfile index b6df151..fe755a9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,26 +5,24 @@ LABEL org.opencontainers.image.source=https://github.com/halide/docker-images WORKDIR /ws -## Install wget -#RUN yum -y install wget - ## Install Ninja -RUN git clone --depth 1 --branch v1.12.1 https://github.com/ninja-build/ninja.git && \ +ARG NINJA_VERSION=v1.12.1 +RUN git clone --depth 1 --branch ${NINJA_VERSION} https://github.com/ninja-build/ninja.git && \ cmake -S ninja -B build -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=OFF && \ cmake --build build --target install -j "$(nproc)" && \ rm -rf ninja build ## Install flatbuffers -ARG FB_VERSION=23.5.26 -RUN wget -q https://github.com/google/flatbuffers/archive/refs/tags/v${FB_VERSION}.tar.gz && \ - tar xvf v${FB_VERSION}.tar.gz && \ - rm v${FB_VERSION}.tar.gz && \ - cmake -G Ninja -S flatbuffers-${FB_VERSION} -B build \ +ARG FB_VERSION=v23.5.26 +RUN git clone --depth 1 --branch ${FB_VERSION} https://github.com/google/flatbuffers.git && \ + cmake -G Ninja -S flatbuffers -B build \ -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_C_COMPILER=$TARGET_CC \ + -DCMAKE_CXX_COMPILER=$TARGET_CXX \ -DFLATBUFFERS_BUILD_TESTS=OFF \ && \ cmake --build build --target install && \ - rm -rf flatbuffers-${FB_VERSION} build + rm -rf flatbuffers build ## Install flatbuffers ARG WABT_VERSION=1.0.36 @@ -32,6 +30,8 @@ RUN git clone --depth 1 --branch ${WABT_VERSION} https://github.com/WebAssembly/ git -C wabt submodule update --init third_party/picosha2 && \ cmake -G Ninja -S wabt -B build \ -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_C_COMPILER=$TARGET_CC \ + -DCMAKE_CXX_COMPILER=$TARGET_CXX \ -DWITH_EXCEPTIONS=ON \ -DBUILD_TESTS=OFF \ -DBUILD_TOOLS=OFF \ @@ -41,16 +41,16 @@ RUN git clone --depth 1 --branch ${WABT_VERSION} https://github.com/WebAssembly/ cmake --build build --target install && \ rm -rf wabt build -## Install LLVM +# Install LLVM ARG LLVM_TAG=llvmorg-18.1.8 -RUN wget -q https://github.com/llvm/llvm-project/archive/refs/tags/${LLVM_TAG}.tar.gz && \ - tar xf ${LLVM_TAG}.tar.gz && \ - rm ${LLVM_TAG}.tar.gz && \ - cmake -G Ninja -S llvm-project-${LLVM_TAG}/llvm -B build \ +RUN git clone --depth 1 --branch ${LLVM_TAG} https://github.com/llvm/llvm-project.git && \ + cmake -G Ninja -S llvm-project/llvm -B build \ "-DLLVM_ENABLE_PROJECTS=clang;lld" \ "-DLLVM_ENABLE_RUNTIMES=compiler-rt" \ "-DLLVM_TARGETS_TO_BUILD=WebAssembly;X86;AArch64;ARM;Hexagon;NVPTX;PowerPC;RISCV" \ -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_C_COMPILER=$TARGET_CC \ + -DCMAKE_CXX_COMPILER=$TARGET_CXX \ -DLLVM_BUILD_32_BITS=OFF \ -DLLVM_ENABLE_ASSERTIONS=ON \ -DLLVM_ENABLE_BINDINGS=OFF \ @@ -72,4 +72,4 @@ RUN wget -q https://github.com/llvm/llvm-project/archive/refs/tags/${LLVM_TAG}.t -DLLVM_INCLUDE_TESTS=OFF \ && \ cmake --build build --target install && \ - rm -rf llvm-project-${LLVM_TAG} build + rm -rf llvm-project build diff --git a/build-images.sh b/build-images.sh index c4604e1..f042520 100755 --- a/build-images.sh +++ b/build-images.sh @@ -4,17 +4,16 @@ set -eo pipefail [[ "$1" == "" ]] && echo "You must specify the LLVM version as an argument, e.g. 17.0.6" && exit -LLVM_TAG=$1 +LLVM_TAG="$1" -docker build \ - --tag "ghcr.io/halide/manylinux_2_28_aarch64-llvm:$LLVM_TAG" \ - --build-arg "LLVM_TAG=llvmorg-$LLVM_TAG" \ - --build-arg "ARCH=aarch64" \ - . - -docker build \ - --tag "ghcr.io/halide/manylinux_2_28_x86_64-llvm:$LLVM_TAG" \ - --build-arg "LLVM_TAG=llvmorg-$LLVM_TAG" \ - --build-arg "ARCH=x86_64" \ - . +build_arch () { + ARCH="$1" + docker build \ + --tag "ghcr.io/halide/manylinux_2_28_$ARCH-llvm:$LLVM_TAG" \ + --build-arg "LLVM_TAG=llvmorg-$LLVM_TAG" \ + --build-arg "ARCH=$ARCH" \ + . +} +build_arch aarch64 +build_arch x86_64 diff --git a/reset-docker.sh b/reset-docker.sh index 951d715..6385210 100755 --- a/reset-docker.sh +++ b/reset-docker.sh @@ -17,7 +17,7 @@ fi ## # Remove all images -docker image prune +docker image prune -f read -ra images < <(docker images -qa) || true if ((${#images[@]} != 0)); then @@ -37,3 +37,7 @@ if ((${#volumes[@]} != 0)); then else echo "No volumes to remove" fi + +## +# Remove everything else +docker system prune -af --volumes