• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
14FROM ubuntu as builder
15# FIXME: Change maintainer name
16LABEL maintainer "Maintainer <maintainer@email>"
17# FIXME: Install llvm/clang build dependencies here. Including compiler to
18# build stage1, cmake, subversion, ninja, etc.
19
20ADD checksums /tmp/checksums
21ADD scripts /tmp/scripts
22
23# Checkout the source code.
24ARG checkout_args
25RUN /tmp/scripts/checkout.sh ${checkout_args}
26# Run the build. Results of the build will be available at /tmp/clang-install/.
27ARG buildscript_args
28RUN /tmp/scripts/build_install_llvm.sh --to /tmp/clang-install ${buildscript_args}
29
30
31# Stage 2. Produce a minimal release image with build results.
32# FIXME: Replace 'ubuntu' with your base image.
33FROM ubuntu
34# FIXME: Change maintainer name.
35LABEL 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.
40COPY --from=builder /tmp/clang-install/ /usr/local/
41