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