-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathllvm.Dockerfile
87 lines (79 loc) · 2.25 KB
/
llvm.Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# Reference: https://www.docker.com/blog/faster-multi-platform-builds-dockerfile-cross-compilation-guide/
# Build stage (no need to optimize for size)
FROM ubuntu:22.04 AS build
WORKDIR /tmp
# Create superbuild project
COPY superbuild.cmake llvm.cmake ./
COPY <<EOF CMakeLists.txt
cmake_minimum_required(VERSION 3.24)
project(llvm)
include(superbuild.cmake)
include(llvm.cmake)
EOF
# CMake APT repository
RUN \
apt update && \
apt install --no-install-recommends -y \
ca-certificates \
gpg \
wget \
sudo \
&& \
wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | gpg --dearmor - | sudo tee /usr/share/keyrings/kitware-archive-keyring.gpg >/dev/null && \
echo 'deb [signed-by=/usr/share/keyrings/kitware-archive-keyring.gpg] https://apt.kitware.com/ubuntu/ jammy main' | sudo tee /etc/apt/sources.list.d/kitware.list >/dev/null
# Install compilers to bootstrap LLVM
RUN \
apt update && \
apt install --no-install-recommends -y \
cmake \
python-is-python3 \
git \
make \
ninja-build \
libz-dev \
libzstd-dev \
libxml2-dev \
flex \
bison \
build-essential
# Build LLVM
RUN \
mkdir /llvm && \
cmake -B build "-DCMAKE_INSTALL_PREFIX=/llvm" && \
cmake --build build && \
rm -rf build
# Actual final image
FROM ubuntu:22.04 AS llvm
LABEL org.opencontainers.image.source=https://github.com/LLVMParty/packages
# Copy LLVM installation
COPY --from=build /llvm /usr/local/
# Install common development packages
RUN \
apt update && \
apt install --no-install-recommends -y \
ca-certificates \
gpg \
wget \
sudo \
&& \
wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | gpg --dearmor - | sudo tee /usr/share/keyrings/kitware-archive-keyring.gpg >/dev/null && \
echo 'deb [signed-by=/usr/share/keyrings/kitware-archive-keyring.gpg] https://apt.kitware.com/ubuntu/ jammy main' | sudo tee /etc/apt/sources.list.d/kitware.list >/dev/null && \
apt update && \
apt install --no-install-recommends -y \
cmake \
curl \
python-is-python3 \
git \
make \
ninja-build \
libstdc++-12-dev \
ncurses-dev \
libz-dev \
libzstd-dev \
libxml2-dev \
binutils \
flex \
bison \
&& \
apt autoremove -y && \
rm -rf /var/lib/apt/lists/*