-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
132 lines (123 loc) · 6.4 KB
/
Dockerfile
File metadata and controls
132 lines (123 loc) · 6.4 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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
ARG CODENAME=bookworm
ARG GCC_RELEASE=14
ARG GCC_DIST=${GCC_RELEASE}-${CODENAME}
FROM gcc:${GCC_DIST} AS gcc
RUN set -ex ;\
find /usr/local/ -type f ;\
cat /etc/ld.so.conf.d/000-local-lib.conf ;\
cat /etc/os-release ;\
/usr/local/bin/gcc --version
ARG CODENAME=bookworm
FROM debian:${CODENAME}
COPY --from=gcc /usr/local/ /usr/local/
COPY --from=gcc /etc/ld.so.conf.d/*.conf /etc/ld.so.conf.d/
ENV HOME=/root
WORKDIR ${HOME}
RUN set -ex ;\
ldconfig -v ;\
dpkg-divert --divert /usr/bin/gcc.orig --rename /usr/bin/gcc ;\
dpkg-divert --divert /usr/bin/g++.orig --rename /usr/bin/g++ ;\
dpkg-divert --divert /usr/bin/gfortran.orig --rename /usr/bin/gfortran ;\
update-alternatives --install /usr/bin/cc cc /usr/local/bin/gcc 999 ;\
update-alternatives --install \
/usr/bin/gcc gcc /usr/local/bin/gcc 100 \
--slave /usr/bin/g++ g++ /usr/local/bin/g++ \
--slave /usr/bin/gfortran gfortran /usr/local/bin/gfortran \
--slave /usr/bin/gcc-ar gcc-ar /usr/local/bin/gcc-ar \
--slave /usr/bin/gcc-nm gcc-nm /usr/local/bin/gcc-nm \
--slave /usr/bin/gcc-ranlib gcc-ranlib /usr/local/bin/gcc-ranlib \
--slave /usr/bin/gcov gcov /usr/local/bin/gcov \
--slave /usr/bin/gcov-tool gcov-tool /usr/local/bin/gcov-tool \
--slave /usr/bin/gcov-dump gcov-dump /usr/local/bin/gcov-dump \
--slave /usr/bin/lto-dump lto-dump /usr/local/bin/lto-dump ;\
update-alternatives --auto cc ;\
update-alternatives --auto gcc
ARG CLANG_RELEASE=19
RUN set -ex ;\
DEBIAN_FRONTEND=noninteractive ;\
CODENAME=$( . /etc/os-release && echo $VERSION_CODENAME ) ;\
apt-get update ;\
apt-get install -y --no-install-recommends ca-certificates wget gpg gpg-agent ;\
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | gpg --dearmor -o /etc/apt/keyrings/llvm.gpg ;\
printf "%s\n%s\n" \
"deb [signed-by=/etc/apt/keyrings/llvm.gpg] https://apt.llvm.org/${CODENAME}/ llvm-toolchain-${CODENAME}-${CLANG_RELEASE} main" \
"deb-src [signed-by=/etc/apt/keyrings/llvm.gpg] https://apt.llvm.org/${CODENAME}/ llvm-toolchain-${CODENAME}-${CLANG_RELEASE} main" \
| tee /etc/apt/sources.list.d/llvm.list ;\
apt-get update ;\
apt-get install -y --no-install-recommends \
lsb-release libc6-dev less vim xxd curl git grep sed gdb zsh lcov make cmake ninja-build openssh-client ccache jq zip unzip bzip2 \
python3 python3-pip python3-venv ;\
apt-get install -t llvm-toolchain-${CODENAME}-${CLANG_RELEASE} -y --no-install-recommends \
clang-${CLANG_RELEASE} clang-tools-${CLANG_RELEASE} clang-tidy-${CLANG_RELEASE} clang-format-${CLANG_RELEASE} \
clangd-${CLANG_RELEASE} libc++-${CLANG_RELEASE}-dev libc++abi-${CLANG_RELEASE}-dev llvm-${CLANG_RELEASE} \
libclang-rt-${CLANG_RELEASE}-dev valgrind ;\
apt-get clean
RUN set -ex ;\
update-alternatives --install \
/usr/bin/clang clang /usr/bin/clang-${CLANG_RELEASE} 100 \
--slave /usr/bin/clang++ clang++ /usr/bin/clang++-${CLANG_RELEASE} ;\
update-alternatives --install \
/usr/bin/llvm-cov llvm-cov /usr/bin/llvm-cov-${CLANG_RELEASE} 100 ;\
update-alternatives --install \
/usr/bin/clang-tidy clang-tidy /usr/bin/clang-tidy-${CLANG_RELEASE} 100 ;\
update-alternatives --install \
/usr/bin/clang-format clang-format /usr/bin/clang-format-${CLANG_RELEASE} 100 ;\
update-alternatives --install \
/usr/bin/clangd clangd /usr/bin/clangd-${CLANG_RELEASE} 100 ;\
update-alternatives --auto clang ;\
update-alternatives --auto llvm-cov ;\
update-alternatives --auto clang-tidy ;\
update-alternatives --auto clang-format ;\
update-alternatives --auto clangd
RUN set -ex ;\
wget -O /etc/zsh/zshrc https://git.grml.org/f/grml-etc-core/etc/zsh/zshrc ;\
wget -O /etc/zsh/newuser.zshrc.recommended https://git.grml.org/f/grml-etc-core/etc/skel/.zshrc ;\
chsh -s /bin/zsh
ENV VENV=${HOME}/venv
ENV PATH=${VENV}/bin:${PATH}
ENV CCACHE_DIR=${HOME}/.ccache
RUN DEBIAN_FRONTEND=noninteractive ;\
set -ex ;\
python3 -m venv ${VENV} ;\
# versions of pre-commit, clang-format and pre-commit-hooks synced with libfn/functional/ci/pre-commit ;\
pip --no-cache-dir install 'gcovr<8' 'PyYAML<7' 'pre-commit<5' 'clang-format==22.1.5' 'pre-commit-hooks==5.0.0' ;\
# enforce fail if clang-format binary used by pre-commit is not installed in the expected location ;\
$(python -c "import site;print(site.getsitepackages()[0])")/clang_format/data/bin/clang-format --version ;\
mkdir -p ${CCACHE_DIR}
ARG NODE_RELEASE=24
RUN DEBIAN_FRONTEND=noninteractive ;\
set -ex ;\
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg ;\
printf "%s\n%s\n" \
"deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_${NODE_RELEASE}.x nodistro main" \
"deb-src [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_${NODE_RELEASE}.x nodistro main" \
| tee /etc/apt/sources.list.d/nodesource.list ;\
printf "%s\n%s\n%s\n" \
"Package: nodejs" \
"Pin: origin deb.nodesource.com" \
"Pin-Priority: 600" \
| tee /etc/apt/preferences.d/nodejs ;\
apt-get update ;\
apt-get install -y --no-install-recommends nodejs ;\
node -v ;\
npm -v ;\
npm install -g prettier ;\
prettier --version ;\
npm install -g @augmentcode/auggie ;\
auggie --version ;\
apt-get clean ;\
npm cache clean --force
ENV EDITOR=vim
ENV VISUAL=vim
ENV CC=/usr/bin/gcc
ENV CXX=/usr/bin/g++
ENV CMAKE_CXX_COMPILER_LAUNCHER=/usr/bin/ccache
ENV CMAKE_GENERATOR=Ninja
ENV CMAKE_BUILD_TYPE=Debug
RUN cp /etc/zsh/newuser.zshrc.recommended .zshrc ;\
touch .zshrc.local ;\
ln -s .profile .zprofile ;\
echo 'export PATH=$(python -c "import site;print(site.getsitepackages()[0])")/clang_format/data/bin:${PATH}' >> .zprofile ;\
echo "alias to-gcc='export CC=/usr/bin/gcc; export CXX=/usr/bin/g++; unset CXXFLAGS; env | grep --color=never -E \"^CC=|^CXX=|^CXXFLAGS=\"'" >> ~/.zprofile ;\
echo "alias to-clang='export CC=/usr/bin/clang; export CXX=/usr/bin/clang++; export CXXFLAGS=-stdlib=libc++; env | grep --color=never -E \"^CC=|^CXX=|^CXXFLAGS=\"'" >> ~/.zprofile ;\
echo "alias rm-build='realpath . | grep \"^.*/\.build[^/]*$\" &>/dev/null && find -mindepth 1 -maxdepth 1 -type d -not -path ./_deps | xargs rm -rf {} \; && find -mindepth 1 -maxdepth 1 -type f | xargs rm -f {} \;'" >> ~/.zprofile