1 #===- llvm/utils/docker/debian8/build/Dockerfile -------------------------===//
3 # Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 # See https://llvm.org/LICENSE.txt for license information.
5 # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 #===----------------------------------------------------------------------===//
8 # Stage 1. Check out LLVM source code and run the build.
9 FROM launcher.gcr.io/google/debian8:latest as builder
10 LABEL maintainer "LLVM Developers"
11 # Install build dependencies of llvm.
12 # First, Update the apt's source list and include the sources of the packages.
13 RUN grep deb /etc/apt/sources.list | \
14 sed 's/^deb/deb-src /g' >> /etc/apt/sources.list
15 # Install compiler, python and subversion.
16 RUN apt-get update && \
17 apt-get install -y --no-install-recommends ca-certificates gnupg \
18 build-essential python wget subversion unzip && \
19 rm -rf /var/lib/apt/lists/*
20 # Install a newer ninja release. It seems the older version in the debian repos
21 # randomly crashes when compiling llvm.
22 RUN wget "https://github.com/ninja-build/ninja/releases/download/v1.8.2/ninja-linux.zip" && \
23 echo "d2fea9ff33b3ef353161ed906f260d565ca55b8ca0568fa07b1d2cab90a84a07 ninja-linux.zip" \
25 unzip ninja-linux.zip -d /usr/local/bin && \
27 # Import public key required for verifying signature of cmake download.
28 RUN gpg --keyserver hkp://pgp.mit.edu --recv 0x2D2CEF1034921684
29 # Download, verify and install cmake version that can compile clang into /usr/local.
30 # (Version in debian8 repos is is too old)
31 RUN mkdir /tmp/cmake-install && cd /tmp/cmake-install && \
32 wget "https://cmake.org/files/v3.7/cmake-3.7.2-SHA-256.txt.asc" && \
33 wget "https://cmake.org/files/v3.7/cmake-3.7.2-SHA-256.txt" && \
34 gpg --verify cmake-3.7.2-SHA-256.txt.asc cmake-3.7.2-SHA-256.txt && \
35 wget "https://cmake.org/files/v3.7/cmake-3.7.2-Linux-x86_64.tar.gz" && \
36 ( grep "cmake-3.7.2-Linux-x86_64.tar.gz" cmake-3.7.2-SHA-256.txt | \
38 tar xzf cmake-3.7.2-Linux-x86_64.tar.gz -C /usr/local --strip-components=1 && \
39 cd / && rm -rf /tmp/cmake-install
41 ADD checksums /tmp/checksums
42 ADD scripts /tmp/scripts
44 # Checkout the source code.
46 RUN /tmp/scripts/checkout.sh ${checkout_args}
47 # Run the build. Results of the build will be available at /tmp/clang-install/.
49 RUN /tmp/scripts/build_install_llvm.sh --to /tmp/clang-install ${buildscript_args}
52 # Stage 2. Produce a minimal release image with build results.
53 FROM launcher.gcr.io/google/debian8:latest
54 LABEL maintainer "LLVM Developers"
55 # Install packages for minimal useful image.
56 RUN apt-get update && \
57 apt-get install -y --no-install-recommends libstdc++-4.9-dev binutils && \
58 rm -rf /var/lib/apt/lists/*
59 # Copy build results of stage 1 to /usr/local.
60 COPY --from=builder /tmp/clang-install/ /usr/local/