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