1d9502010SIlya Biryukov#===- llvm/utils/docker/example/build/Dockerfile -------------------------===//
2d9502010SIlya Biryukov#
3d9502010SIlya Biryukov#                     The LLVM Compiler Infrastructure
4d9502010SIlya Biryukov#
5d9502010SIlya Biryukov# This file is distributed under the University of Illinois Open Source
6d9502010SIlya Biryukov# License. See LICENSE.TXT for details.
7d9502010SIlya Biryukov#
8d9502010SIlya Biryukov#===----------------------------------------------------------------------===//
9d9502010SIlya Biryukov# This is an example Dockerfile to build an image that compiles clang.
10d9502010SIlya Biryukov# Replace FIXMEs to prepare your own image.
11d9502010SIlya Biryukov
12d9502010SIlya Biryukov# Stage 1. Check out LLVM source code and run the build.
13d9502010SIlya Biryukov# FIXME: Replace 'ubuntu' with your base image
14d9502010SIlya BiryukovFROM ubuntu as builder
15d9502010SIlya Biryukov# FIXME: Change maintainer name
16d9502010SIlya BiryukovLABEL maintainer "Maintainer <maintainer@email>"
17d9502010SIlya Biryukov# FIXME: Install llvm/clang build dependencies here. Including compiler to
18d9502010SIlya Biryukov# build stage1, cmake, subversion, ninja, etc.
19d9502010SIlya Biryukov
20d9502010SIlya BiryukovADD checksums /tmp/checksums
21d9502010SIlya BiryukovADD scripts /tmp/scripts
22*2bf7c51dSIlya Biryukov
23*2bf7c51dSIlya Biryukov# Checkout the source code.
24*2bf7c51dSIlya BiryukovARG checkout_args
25*2bf7c51dSIlya BiryukovRUN /tmp/scripts/checkout.sh ${checkout_args}
26*2bf7c51dSIlya Biryukov# Run the build. Results of the build will be available at /tmp/clang-install/.
27d9502010SIlya BiryukovARG buildscript_args
28*2bf7c51dSIlya BiryukovRUN /tmp/scripts/build_install_llvm.sh --to /tmp/clang-install ${buildscript_args}
29d9502010SIlya Biryukov
30d9502010SIlya Biryukov
31d9502010SIlya Biryukov# Stage 2. Produce a minimal release image with build results.
32d9502010SIlya Biryukov# FIXME: Replace 'ubuntu' with your base image.
33d9502010SIlya BiryukovFROM ubuntu
34d9502010SIlya Biryukov# FIXME: Change maintainer name.
35d9502010SIlya BiryukovLABEL maintainer "Maintainer <maintainer@email>"
36d9502010SIlya Biryukov# FIXME: Install all packages you want to have in your release container.
37d9502010SIlya Biryukov# A minimal useful installation should include at least libstdc++ and binutils.
38d9502010SIlya Biryukov
39d9502010SIlya Biryukov# Copy build results of stage 1 to /usr/local.
40d9502010SIlya BiryukovCOPY --from=builder /tmp/clang-install/ /usr/local/
41