[llvm] 9580f95 - [Dockerfile] Upgrade debian base image to version 10

Ben Shi via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 23 08:32:28 PDT 2022


Author: Xiaodong Liu
Date: 2022-03-23T15:32:15Z
New Revision: 9580f954888f593631a2bd4e7bb8ded1eb15700b

URL: https://github.com/llvm/llvm-project/commit/9580f954888f593631a2bd4e7bb8ded1eb15700b
DIFF: https://github.com/llvm/llvm-project/commit/9580f954888f593631a2bd4e7bb8ded1eb15700b.diff

LOG: [Dockerfile] Upgrade debian base image to version 10

Debian8 is too old to build LLVM project, the version
of GCC, CMake and python are lower than the requirements:
https://llvm.org/docs/GettingStarted.html#software

Debian10 is the earliest release that has software
packages that meet the above requirements.

Reviewed By: sammccall

Differential Revision: https://reviews.llvm.org/D120826

Added: 
    llvm/utils/docker/debian10/Dockerfile

Modified: 
    llvm/docs/Docker.rst
    llvm/utils/docker/build_docker_image.sh

Removed: 
    llvm/utils/docker/debian8/Dockerfile


################################################################################
diff  --git a/llvm/docs/Docker.rst b/llvm/docs/Docker.rst
index 5a61ff988b05a..6b3c80da684b4 100644
--- a/llvm/docs/Docker.rst
+++ b/llvm/docs/Docker.rst
@@ -9,7 +9,7 @@ You can find a number of sources to build docker images with LLVM components in
 images for their own use, or as a starting point for someone who wants to write
 their own Dockerfiles.
 
-We currently provide Dockerfiles with ``debian8`` and ``nvidia-cuda`` base images.
+We currently provide Dockerfiles with ``debian10`` and ``nvidia-cuda`` base images.
 We also provide an ``example`` image, which contains placeholders that one would need
 to fill out in order to produce Dockerfiles for a new docker image.
 
@@ -72,13 +72,13 @@ checkout from git and provide a list of CMake arguments to use during when
 building LLVM inside docker container.
 
 Here's a very simple example of getting a docker image with clang binary,
-compiled by the system compiler in the debian8 image:
+compiled by the system compiler in the debian10 image:
 
 .. code-block:: bash
 
     ./llvm/utils/docker/build_docker_image.sh \
-	--source debian8 \
-	--docker-repository clang-debian8 --docker-tag "staging" \
+	--source debian10 \
+	--docker-repository clang-debian10 --docker-tag "staging" \
 	-p clang -i install-clang -i install-clang-resource-headers \
 	-- \
 	-DCMAKE_BUILD_TYPE=Release
@@ -93,22 +93,22 @@ this command will do that:
     #   LLVM_TARGETS_TO_BUILD=Native is to reduce stage1 compile time.
     #   Options, starting with BOOTSTRAP_* are passed to stage2 cmake invocation.
     ./build_docker_image.sh \
-	--source debian8 \
-	--docker-repository clang-debian8 --docker-tag "staging" \
+	--source debian10 \
+	--docker-repository clang-debian10 --docker-tag "staging" \
 	-p clang -i stage2-install-clang -i stage2-install-clang-resource-headers \
 	-- \
 	-DLLVM_TARGETS_TO_BUILD=Native -DCMAKE_BUILD_TYPE=Release \
 	-DBOOTSTRAP_CMAKE_BUILD_TYPE=Release \
 	-DCLANG_ENABLE_BOOTSTRAP=ON -DCLANG_BOOTSTRAP_TARGETS="install-clang;install-clang-resource-headers"
 	
-This will produce a new image ``clang-debian8:staging`` from the latest
+This will produce a new image ``clang-debian10:staging`` from the latest
 upstream revision.
 After the image is built you can run bash inside a container based on your image
 like this:
 
 .. code-block:: bash
 
-    docker run -ti clang-debian8:staging bash
+    docker run -ti clang-debian10:staging bash
 
 Now you can run bash commands as you normally would:
 
@@ -130,14 +130,14 @@ Now you can run bash commands as you normally would:
 
 Which image should I choose?
 ============================
-We currently provide two images: debian8-based and nvidia-cuda-based. They
+We currently provide two images: Debian10-based and nvidia-cuda-based. They
 
diff er in the base image that they use, i.e. they have a 
diff erent set of
 preinstalled binaries. Debian8 is very minimal, nvidia-cuda is larger, but has
 preinstalled CUDA libraries and allows to access a GPU, installed on your
 machine.
 
 If you need a minimal linux distribution with only clang and libstdc++ included,
-you should try debian8-based image.
+you should try Debian10-based image.
 
 If you want to use CUDA libraries and have access to a GPU on your machine,
 you should choose nvidia-cuda-based image and use `nvidia-docker
@@ -150,7 +150,7 @@ If you have a 
diff erent use-case, you could create your own image based on
 ``example/`` folder.
 
 Any docker image can be built and run using only the docker binary, i.e. you can
-run debian8 build on Fedora or any other Linux distribution. You don't need to
+run debian10 build on Fedora or any other Linux distribution. You don't need to
 install CMake, compilers or any other clang dependencies. It is all handled
 during the build process inside Docker's isolated environment.
 
@@ -158,12 +158,12 @@ Stable build
 ============
 If you want a somewhat recent and somewhat stable build, use the
 ``branches/google/stable`` branch, i.e. the following command will produce a
-debian8-based image using the latest ``google/stable`` sources for you:
+Debian10-based image using the latest ``google/stable`` sources for you:
 
 .. code-block:: bash
 
     ./llvm/utils/docker/build_docker_image.sh \
-	-s debian8 --d clang-debian8 -t "staging" \
+	-s debian10 --d clang-debian10 -t "staging" \
 	--branch branches/google/stable \
 	-p clang -i install-clang -i install-clang-resource-headers \
 	-- \

diff  --git a/llvm/utils/docker/build_docker_image.sh b/llvm/utils/docker/build_docker_image.sh
index 295fa51171040..320e64fe678c4 100755
--- a/llvm/utils/docker/build_docker_image.sh
+++ b/llvm/utils/docker/build_docker_image.sh
@@ -23,7 +23,7 @@ Available options:
   General:
     -h|--help               show this help message
   Docker-specific:
-    -s|--source             image source dir (i.e. debian8, nvidia-cuda, etc)
+    -s|--source             image source dir (i.e. debian10, nvidia-cuda, etc)
     -d|--docker-repository  docker repository for the image
     -t|--docker-tag         docker tag for the image
   Checkout arguments:
@@ -54,18 +54,18 @@ Required options: --source and --docker-repository, at least one
 All options after '--' are passed to CMake invocation.
 
 For example, running:
-$ build_docker_image.sh -s debian8 -d mydocker/debian8-clang -t latest \ 
+$ build_docker_image.sh -s debian10 -d mydocker/debian10-clang -t latest \
   -p clang -i install-clang -i install-clang-resource-headers
 will produce two docker images:
-    mydocker/debian8-clang-build:latest - an intermediate image used to compile
+    mydocker/debian10-clang-build:latest - an intermediate image used to compile
       clang.
-    mydocker/clang-debian8:latest       - a small image with preinstalled clang.
+    mydocker/clang-debian10:latest       - a small image with preinstalled clang.
 Please note that this example produces a not very useful installation, since it
 doesn't override CMake defaults, which produces a Debug and non-boostrapped
 version of clang.
 
 To get a 2-stage clang build, you could use this command:
-$ ./build_docker_image.sh -s debian8 -d mydocker/clang-debian8 -t "latest" \ 
+$ ./build_docker_image.sh -s debian10 -d mydocker/clang-debian10 -t "latest" \
     -p clang -i stage2-install-clang -i stage2-install-clang-resource-headers \ 
     -- \ 
     -DLLVM_TARGETS_TO_BUILD=Native -DCMAKE_BUILD_TYPE=Release \ 

diff  --git a/llvm/utils/docker/debian8/Dockerfile b/llvm/utils/docker/debian10/Dockerfile
similarity index 60%
rename from llvm/utils/docker/debian8/Dockerfile
rename to llvm/utils/docker/debian10/Dockerfile
index 9d0e2b8d795e5..3094fed333670 100644
--- a/llvm/utils/docker/debian8/Dockerfile
+++ b/llvm/utils/docker/debian10/Dockerfile
@@ -1,4 +1,4 @@
-#===- llvm/utils/docker/debian8/build/Dockerfile -------------------------===//
+#===- llvm/utils/docker/debian10/build/Dockerfile -------------------------===//
 #
 # Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
 # See https://llvm.org/LICENSE.txt for license information.
@@ -6,7 +6,7 @@
 #
 #===----------------------------------------------------------------------===//
 # Stage 1. Check out LLVM source code and run the build.
-FROM launcher.gcr.io/google/debian8:latest as builder
+FROM launcher.gcr.io/google/debian10:latest as builder
 LABEL maintainer "LLVM Developers"
 # Install build dependencies of llvm.
 # First, Update the apt's source list and include the sources of the packages.
@@ -15,7 +15,7 @@ RUN grep deb /etc/apt/sources.list | \
 # Install compiler, python and subversion.
 RUN apt-get update && \
     apt-get install -y --no-install-recommends ca-certificates gnupg \
-           build-essential python wget subversion unzip && \
+           build-essential cmake make python3 zlib1g wget subversion unzip && \
     rm -rf /var/lib/apt/lists/*
 # Install a newer ninja release. It seems the older version in the debian repos
 # randomly crashes when compiling llvm.
@@ -24,19 +24,6 @@ RUN wget "https://github.com/ninja-build/ninja/releases/download/v1.8.2/ninja-li
         | sha256sum -c  && \
     unzip ninja-linux.zip -d /usr/local/bin && \
     rm ninja-linux.zip
-# Import public key required for verifying signature of cmake download.
-RUN gpg --keyserver hkp://pgp.mit.edu --recv 0x2D2CEF1034921684
-# Download, verify and install cmake version that can compile clang into /usr/local.
-# (Version in debian8 repos is is too old)
-RUN mkdir /tmp/cmake-install && cd /tmp/cmake-install && \
-    wget "https://cmake.org/files/v3.7/cmake-3.7.2-SHA-256.txt.asc" && \
-    wget "https://cmake.org/files/v3.7/cmake-3.7.2-SHA-256.txt" && \
-    gpg --verify cmake-3.7.2-SHA-256.txt.asc cmake-3.7.2-SHA-256.txt && \
-    wget "https://cmake.org/files/v3.7/cmake-3.7.2-Linux-x86_64.tar.gz" && \
-    ( grep "cmake-3.7.2-Linux-x86_64.tar.gz" cmake-3.7.2-SHA-256.txt | \
-      sha256sum -c - ) && \
-    tar xzf cmake-3.7.2-Linux-x86_64.tar.gz -C /usr/local --strip-components=1 && \
-    cd / && rm -rf /tmp/cmake-install
 
 ADD checksums /tmp/checksums
 ADD scripts /tmp/scripts
@@ -50,11 +37,11 @@ RUN /tmp/scripts/build_install_llvm.sh --to /tmp/clang-install ${buildscript_arg
 
 
 # Stage 2. Produce a minimal release image with build results.
-FROM launcher.gcr.io/google/debian8:latest
+FROM launcher.gcr.io/google/debian10:latest
 LABEL maintainer "LLVM Developers"
 # Install packages for minimal useful image.
 RUN apt-get update && \
-    apt-get install -y --no-install-recommends libstdc++-4.9-dev binutils && \
+    apt-get install -y --no-install-recommends libstdc++-7-dev binutils && \
     rm -rf /var/lib/apt/lists/*
 # Copy build results of stage 1 to /usr/local.
 COPY --from=builder /tmp/clang-install/ /usr/local/


        


More information about the llvm-commits mailing list