| 1 |
#===- llvm/utils/docker/debian12/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 |
# Stage 1. Check out LLVM source code and run the build. |
| 9 |
FROM launcher.gcr.io/google/debian12:latest AS builder |
| 10 |
LABEL maintainer="LLVM Developers" |
| 11 |
# Install build dependencies of llvm. |
| 12 |
# First, Update the apt's source list and include the sources of the packages. |
| 13 |
RUN grep deb /etc/apt/sources.list | \ |
| 14 |
sed 's/^deb/deb-src /g' >> /etc/apt/sources.list |
| 15 |
# Install compiler, python and subversion. |
| 16 |
RUN apt-get update && \ |
| 17 |
apt-get install -y --no-install-recommends ca-certificates gnupg \ |
| 18 |
build-essential cmake make python3 zlib1g wget subversion unzip git && \ |
| 19 |
rm -rf /var/lib/apt/lists/* |
| 20 |
# Install a newer ninja release. It seems the older version in the debian repos |
| 21 |
# randomly crashes when compiling llvm. |
| 22 |
RUN wget "https://github.com/ninja-build/ninja/releases/download/v1.12.1/ninja-linux.zip" && \ |
| 23 |
echo "6f98805688d19672bd699fbbfa2c2cf0fc054ac3df1f0e6a47664d963d530255 ninja-linux.zip" \ |
| 24 |
| sha256sum -c && \ |
| 25 |
unzip ninja-linux.zip -d /usr/local/bin && \ |
| 26 |
rm ninja-linux.zip |
| 27 |
|
| 28 |
ADD checksums /tmp/checksums |
| 29 |
ADD scripts /tmp/scripts |
| 30 |
|
| 31 |
# Checkout the source code. |
| 32 |
ARG checkout_args |
| 33 |
RUN /tmp/scripts/checkout.sh ${checkout_args} |
| 34 |
# Run the build. Results of the build will be available at /tmp/clang-install/. |
| 35 |
ARG buildscript_args |
| 36 |
RUN /tmp/scripts/build_install_llvm.sh --to /tmp/clang-install ${buildscript_args} |
| 37 |
|
| 38 |
|
| 39 |
# Stage 2. Produce a minimal release image with build results. |
| 40 |
FROM launcher.gcr.io/google/debian12:latest |
| 41 |
LABEL maintainer="LLVM Developers" |
| 42 |
# Install packages for minimal useful image. |
| 43 |
RUN apt-get update && \ |
| 44 |
apt-get install -y --no-install-recommends binutils && \ |
| 45 |
rm -rf /var/lib/apt/lists/* |
| 46 |
# Copy build results of stage 1 to /usr/local. |
| 47 |
COPY --from=builder /tmp/clang-install/ /usr/local/ |