-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile_build
More file actions
114 lines (90 loc) · 3.39 KB
/
Dockerfile_build
File metadata and controls
114 lines (90 loc) · 3.39 KB
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
#############################################
# milss/tradercppbuild:v1.8
# Build container for tradercpp
# Published to dockerhub in order to accelerate github actions
# Uses:
# - Ubuntu 24.04
# - CMake 4
# - Conan 2 (incl. Python3)
# - GCC 13
# - LLVM 18 (clang-format and clang-tidy)
# - make
# - ninja-build
# - perl (compilation dependency for conan packages)
# - coverage (lcov, gcovr)
#############################################
FROM ubuntu:24.04 AS build_container
LABEL org.opencontainers.image.title="tradercppbuild" \
org.opencontainers.image.description="Container for building the trader.cpp app" \
org.opencontainers.image.source="https://github.com/milsanore/trader.cpp" \
maintainer="https://github.com/milsanore"
# Set noninteractive mode to avoid prompts during install
ENV DEBIAN_FRONTEND=noninteractive
# Install CMake 4
ARG CMAKE_VERSION=4.1.2-0kitware1ubuntu24.04.1
RUN apt update && apt install -y --no-install-recommends \
ca-certificates \
gnupg \
lsb-release \
wget \
&& rm -rf /var/lib/apt/lists/*
RUN wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | \
gpg --dearmor - | 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/ $(lsb_release -cs) main" | \
tee /etc/apt/sources.list.d/kitware.list >/dev/null
RUN apt update && apt install -y --no-install-recommends \
cmake=${CMAKE_VERSION} \
&& rm -rf /var/lib/apt/lists/*
# Install GCC 13
RUN apt update && apt install -y --no-install-recommends \
software-properties-common && \
add-apt-repository ppa:ubuntu-toolchain-r/test -y && \
apt update && apt install -y --no-install-recommends \
g++-13 \
gcc-13 \
&& rm -rf /var/lib/apt/lists/*
# Install LLVM 18 (clang-format and clang-tidy)
RUN wget -qO - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add -
RUN echo "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-18 main" > /etc/apt/sources.list.d/llvm18.list
RUN apt update && apt install -y --no-install-recommends \
clang-format-18 \
clang-tidy-18 \
libc++-18-dev \
libclang-18-dev \
libclang-rt-18-dev \
&& rm -rf /var/lib/apt/lists/*
RUN update-alternatives --install /usr/bin/clang-format clang-format /usr/bin/clang-format-18 100 && \
update-alternatives --install /usr/bin/clang-tidy clang-tidy /usr/bin/clang-tidy-18 100
# Install Conan 2 (and profile)
ARG CONAN_VERSION=2.19.1
RUN apt update && apt install -y --no-install-recommends \
python3 python3-pip python3-venv \
&& rm -rf /var/lib/apt/lists/*
RUN python3 -m venv /opt/conan-venv && \
/opt/conan-venv/bin/pip install --upgrade pip && \
/opt/conan-venv/bin/pip install gcovr && \
/opt/conan-venv/bin/pip install "conan==${CONAN_VERSION}"
# TODO: --no-cache-dir
ENV PATH="/opt/conan-venv/bin:$PATH"
RUN mkdir -p /root/.conan2/profiles && printf \
"[settings]\n\
arch=x86_64\n\
build_type=Release\n\
compiler=gcc\n\
compiler.cppstd=gnu23\n\
compiler.libcxx=libstdc++11\n\
compiler.version=13\n\
os=Linux\n" \
> /root/.conan2/profiles/default
# Install build tools
RUN apt update && apt install -y --no-install-recommends \
build-essential \
curl \
git \
lcov \
make \
ninja-build \
perl \
shellcheck \
unzip \
&& rm -rf /var/lib/apt/lists/*