-
Notifications
You must be signed in to change notification settings - Fork 27
/
Copy pathDockerfile
51 lines (47 loc) · 2.16 KB
/
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
ARG IMAGE=ubuntu:22.04
FROM --platform=linux/amd64 ${IMAGE} as builder
ENV INSTALL_DIR=/work/install
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
# Install dependencies
RUN apt-get update \
&& apt-get install --no-install-recommends -y curl gnupg software-properties-common lsb-release \
&& sudo apt remove --purge --auto-remove cmake \
&& sudo apt update \
&& sudo apt clean all \
&& wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | gpg --dearmor - | sudo tee /etc/apt/trusted.gpg.d/kitware.gpg >/dev/null \
&& sudo apt-add-repository "deb https://apt.kitware.com/ubuntu/ $(lsb_release -cs) main" \
&& sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 6AF7F09730B3F0A4 \
&& sudo apt update \
&& sudo apt install kitware-archive-keyring \
&& sudo rm /etc/apt/trusted.gpg.d/kitware.gpg \
&& curl -sSL https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add - \
&& echo "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-18 main" | tee -a /etc/apt/sources.list \
&& echo "deb-src http://apt.llvm.org/jammy/ llvm-toolchain-jammy-18 main" | tee -a /etc/apt/sources.list \
&& add-apt-repository ppa:ubuntu-toolchain-r/test \
&& apt-get install --no-install-recommends -y \
gpg zip unzip tar git \
pkg-config ninja-build ccache cmake build-essential \
doctest-dev \
clang-18 lld-18 \
python3.11 python3.11-dev \
&& curl -sS https://bootstrap.pypa.io/get-pip.py | python3.11 \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /work
RUN mkdir src build
COPY . /work/src/multiplier
RUN cmake \
-S '/work/src/multiplier' \
-B '/work/build/multiplier' \
-G Ninja \
-DCMAKE_LINKER_TYPE=LLD \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_C_COMPILER="$(which clang-18)" \
-DCMAKE_CXX_COMPILER="$(which clang++-18)" \
-DCMAKE_INSTALL_PREFIX="${INSTALL_DIR}" \
-DCMAKE_INTERPROCEDURAL_OPTIMIZATION=TRUE
RUN cmake --build '/work/build/multiplier' --target install
RUN chmod +x /work/install/bin/*
ENV PATH="/work/install/bin:${PATH}"
FROM --platform=linux/amd64 ${IMAGE} as release
COPY --from=builder /work/install /work/install