• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#===- llvm/utils/docker/example/build/Dockerfile -------------------------===//
2#
3# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4# See https://llvm.org/LICENSE.txt for license information.
5# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6#
7#===----------------------------------------------------------------------===//
8# This is an example Dockerfile to build an image that compiles clang.
9# Replace FIXMEs to prepare your own image.
10
11# Stage 1. Check out LLVM source code and run the build.
12# FIXME: Replace 'ubuntu' with your base image
13FROM ubuntu as builder
14# FIXME: Change maintainer name
15LABEL maintainer "Maintainer <maintainer@email>"
16# FIXME: Install llvm/clang build dependencies here. Including compiler to
17# build stage1, cmake, subversion, ninja, etc.
18
19ADD checksums /tmp/checksums
20ADD scripts /tmp/scripts
21
22# Checkout the source code.
23ARG checkout_args
24RUN /tmp/scripts/checkout.sh ${checkout_args}
25# Run the build. Results of the build will be available at /tmp/clang-install/.
26ARG buildscript_args
27RUN /tmp/scripts/build_install_llvm.sh --to /tmp/clang-install ${buildscript_args}
28
29
30# Stage 2. Produce a minimal release image with build results.
31# FIXME: Replace 'ubuntu' with your base image.
32FROM ubuntu
33# FIXME: Change maintainer name.
34LABEL maintainer "Maintainer <maintainer@email>"
35# FIXME: Install all packages you want to have in your release container.
36# A minimal useful installation should include at least libstdc++ and binutils.
37
38# Copy build results of stage 1 to /usr/local.
39COPY --from=builder /tmp/clang-install/ /usr/local/
40