Ilya Biryukov | d950201 | 2018-03-26 15:12:30 +0000 | [diff] [blame] | 1 | #===- llvm/utils/docker/example/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 | # This is an example Dockerfile to build an image that compiles clang. |
| 10 | # Replace FIXMEs to prepare your own image. |
| 11 | |
| 12 | # Stage 1. Check out LLVM source code and run the build. |
| 13 | # FIXME: Replace 'ubuntu' with your base image |
| 14 | FROM ubuntu as builder |
| 15 | # FIXME: Change maintainer name |
| 16 | LABEL maintainer "Maintainer <maintainer@email>" |
| 17 | # FIXME: Install llvm/clang build dependencies here. Including compiler to |
| 18 | # build stage1, cmake, subversion, ninja, etc. |
| 19 | |
| 20 | ADD checksums /tmp/checksums |
| 21 | ADD scripts /tmp/scripts |
Ilya Biryukov | 2bf7c51 | 2018-04-20 10:19:38 +0000 | [diff] [blame] | 22 | |
| 23 | # Checkout the source code. |
| 24 | ARG checkout_args |
| 25 | RUN /tmp/scripts/checkout.sh ${checkout_args} |
| 26 | # Run the build. Results of the build will be available at /tmp/clang-install/. |
Ilya Biryukov | d950201 | 2018-03-26 15:12:30 +0000 | [diff] [blame] | 27 | ARG buildscript_args |
Ilya Biryukov | 2bf7c51 | 2018-04-20 10:19:38 +0000 | [diff] [blame] | 28 | RUN /tmp/scripts/build_install_llvm.sh --to /tmp/clang-install ${buildscript_args} |
Ilya Biryukov | d950201 | 2018-03-26 15:12:30 +0000 | [diff] [blame] | 29 | |
| 30 | |
| 31 | # Stage 2. Produce a minimal release image with build results. |
| 32 | # FIXME: Replace 'ubuntu' with your base image. |
| 33 | FROM ubuntu |
| 34 | # FIXME: Change maintainer name. |
| 35 | LABEL maintainer "Maintainer <maintainer@email>" |
| 36 | # FIXME: Install all packages you want to have in your release container. |
| 37 | # A minimal useful installation should include at least libstdc++ and binutils. |
| 38 | |
| 39 | # Copy build results of stage 1 to /usr/local. |
| 40 | COPY --from=builder /tmp/clang-install/ /usr/local/ |