diff options
| author | Ilya Biryukov <ibiryukov@google.com> | 2018-03-26 15:12:30 +0000 |
|---|---|---|
| committer | Ilya Biryukov <ibiryukov@google.com> | 2018-03-26 15:12:30 +0000 |
| commit | d95020108c48d785b99b08cce423134a8463a95d (patch) | |
| tree | 96aad211e3f56ccf10cc088bdfce16d38bf5e584 /llvm/utils/docker/debian8 | |
| parent | 4fd4fd610c53aaa9af3bce975fe96b108449359e (diff) | |
| download | bcm5719-llvm-d95020108c48d785b99b08cce423134a8463a95d.tar.gz bcm5719-llvm-d95020108c48d785b99b08cce423134a8463a95d.zip | |
Migrate dockerfiles to use multi-stage builds.
Summary:
We previously emulated multi-staged builds using two dockerfiles,
native support from Docker allows us to merge them into one,
simplifying our scripts.
For more details about multi-stage builds, see:
https://docs.docker.com/develop/develop-images/multistage-build/
Reviewers: mehdi_amini, klimek, sammccall
Reviewed By: sammccall
Subscribers: llvm-commits, ioeric, cfe-commits
Differential Revision: https://reviews.llvm.org/D44787
llvm-svn: 328503
Diffstat (limited to 'llvm/utils/docker/debian8')
| -rw-r--r-- | llvm/utils/docker/debian8/Dockerfile (renamed from llvm/utils/docker/debian8/build/Dockerfile) | 25 | ||||
| -rw-r--r-- | llvm/utils/docker/debian8/release/Dockerfile | 21 |
2 files changed, 14 insertions, 32 deletions
diff --git a/llvm/utils/docker/debian8/build/Dockerfile b/llvm/utils/docker/debian8/Dockerfile index 3f42f2ad591..fd3bf9f49f0 100644 --- a/llvm/utils/docker/debian8/build/Dockerfile +++ b/llvm/utils/docker/debian8/Dockerfile @@ -6,22 +6,18 @@ # License. See LICENSE.TXT for details. # #===----------------------------------------------------------------------===// -# Produces an image that compiles and archives clang, based on debian8. -FROM launcher.gcr.io/google/debian8:latest - +# Stage 1. Check out LLVM source code and run the build. +FROM launcher.gcr.io/google/debian8: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. RUN grep deb /etc/apt/sources.list | \ sed 's/^deb/deb-src /g' >> /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 && \ 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. RUN wget "https://github.com/ninja-build/ninja/releases/download/v1.8.2/ninja-linux.zip" && \ @@ -29,10 +25,8 @@ 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 && \ @@ -47,9 +41,18 @@ RUN mkdir /tmp/cmake-install && cd /tmp/cmake-install && \ ADD checksums /tmp/checksums ADD scripts /tmp/scripts - # Arguments passed to build_install_clang.sh. ARG buildscript_args - -# Run the build. Results of the build will be available as /tmp/clang.tar.gz. +# Run the build. Results of the build will be available at /tmp/clang-install/. RUN /tmp/scripts/build_install_llvm.sh ${buildscript_args} + + +# Stage 2. Produce a minimal release image with build results. +FROM launcher.gcr.io/google/debian8: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 && \ + rm -rf /var/lib/apt/lists/* +# Copy build results of stage 1 to /usr/local. +COPY --from=builder /tmp/clang-install/ /usr/local/ diff --git a/llvm/utils/docker/debian8/release/Dockerfile b/llvm/utils/docker/debian8/release/Dockerfile deleted file mode 100644 index 3a44a7d4116..00000000000 --- a/llvm/utils/docker/debian8/release/Dockerfile +++ /dev/null @@ -1,21 +0,0 @@ -#===- llvm/utils/docker/debian8/release/Dockerfile -----------------------===// -# -# The LLVM Compiler Infrastructure -# -# This file is distributed under the University of Illinois Open Source -# License. See LICENSE.TXT for details. -# -#===----------------------------------------------------------------------===// -# A release image, containing clang installation, produced by the 'build/' image -# and adding libstdc++ and binutils. -FROM launcher.gcr.io/google/debian8: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 && \ - rm -rf /var/lib/apt/lists/* - -# Unpack clang installation into this image. -ADD clang.tar.gz /usr/local/ |

