-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
235 lines (219 loc) · 10.5 KB
/
Copy pathDockerfile
File metadata and controls
235 lines (219 loc) · 10.5 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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
ARG CODENAME=trixie
ARG GCC_RELEASE=16
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/c++ c++ /usr/local/bin/g++ 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 NODE_RELEASE=24
ARG JAVA_VERSION=openjdk-21-jdk
RUN set -ex ;\
export DEBIAN_FRONTEND=noninteractive ;\
apt-get update ;\
apt-get install -y --no-install-recommends ca-certificates curl gpg ;\
curl --proto '=https' --tlsv1.2 -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 \
wget gpg-agent bison flex libiconv-hook-dev openssh-client zsh \
lsb-release libc-devtools libc6-dev less vim xxd git grep sed \
gdb lcov make cmake ninja-build ccache zip unzip bzip2 \
psmisc patch valgrind unifdef gh jq nodejs \
python3 python3-pip python3-venv ${JAVA_VERSION} graphviz \
binfmt-support qemu-user-binfmt qemu-user g++-aarch64-linux-gnu ;\
gdb --version ;\
cmake --version ;\
node --version ;\
npm --version ;\
apt-get clean && rm -rf /var/lib/apt/lists/*
ARG CLANG_RELEASE=22
RUN set -ex ;\
export DEBIAN_FRONTEND=noninteractive ;\
CODENAME=$( . /etc/os-release && echo $VERSION_CODENAME ) ;\
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 -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-${CLANG_RELEASE}-dev llvm-${CLANG_RELEASE}-dev libclang-rt-${CLANG_RELEASE}-dev ;\
apt-get clean && rm -rf /var/lib/apt/lists/*
RUN set -ex ;\
export DEBIAN_FRONTEND=noninteractive ;\
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 set -ex ;\
python3 -m venv ${VENV} ;\
python --version ;\
# 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' 'pre-commit-hooks==5.0.0' 'clang-format==22.1.5' clangd shellcheck-py ;\
# cvise imports these past stdlib ;\
pip --no-cache-dir install chardet psutil pebble msgspec zstandard ;\
# 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}
RUN set -ex ;\
npm install -g prettier ;\
prettier --version ;\
npm install -g @augmentcode/auggie @anthropic-ai/claude-code ;\
auggie --version ;\
claude --version ;\
npm cache clean --force
ARG RUST_RELEASE=stable
ENV RUSTUP_HOME=/usr/local/rustup
ENV CARGO_HOME=/usr/local/cargo
ENV PATH=/usr/local/cargo/bin:${PATH}
RUN set -ex ;\
arch=$(uname -m) ;\
case "$arch" in \
x86_64) rustArch='x86_64-unknown-linux-gnu' ;;\
aarch64) rustArch='aarch64-unknown-linux-gnu' ;;\
*) echo "unsupported architecture: $arch"; exit 1 ;;\
esac ;\
url="https://static.rust-lang.org/rustup/dist/${rustArch}/rustup-init" ;\
curl --proto '=https' --tlsv1.2 -sSf "${url}" -o rustup-init ;\
chmod +x rustup-init ;\
./rustup-init -y \
--no-modify-path \
--default-toolchain ${RUST_RELEASE} \
--profile minimal \
--component clippy,rustfmt \
--target wasm32-unknown-unknown ;\
rm rustup-init ;\
chmod -R a+w ${RUSTUP_HOME} ${CARGO_HOME}
ARG GO_RELEASE=1.26.4
ENV PATH=/usr/local/go/bin:${PATH}
RUN set -ex ;\
url="https://go.dev/dl/go${GO_RELEASE}.linux-$(dpkg --print-architecture).tar.gz" ;\
curl --proto '=https' --tlsv1.2 -fsSL "${url}" -o go.tgz ;\
rm -rf /usr/local/go ;\
tar -C /usr/local -xzf go.tgz ;\
rm -f go.tgz ;\
go version
# TREE_SITTER_RELEASE must match tree-sitter/Makefile VERSION at CVISE_COMMIT.
ARG CVISE_COMMIT=64ff7de2
ARG TREE_SITTER_RELEASE=0.25.8
RUN set -ex ;\
cargo install tree-sitter-cli --version ${TREE_SITTER_RELEASE} --root /usr/local ;\
git clone https://github.com/marxin/cvise /root/cvise ;\
git -C /root/cvise checkout ${CVISE_COMMIT} ;\
cmake -G Ninja -S /root/cvise -B /root/cvise/build \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_PREFIX_PATH=/usr/lib/llvm-${CLANG_RELEASE} \
-DCMAKE_C_FLAGS=-Wno-error=sign-compare \
-DCMAKE_INSTALL_PREFIX=/usr/local \
-DPython3_EXECUTABLE=${VENV}/bin/python ;\
cmake --build /root/cvise/build ;\
cmake --build /root/cvise/build --target install ;\
rm -rf /root/cvise ;\
cvise --version
ARG DOXYGEN_RELEASE=1.12.0
RUN set -ex ;\
: "${DOXYGEN_RELEASE:?DOXYGEN_RELEASE is not set}" ;\
DIST="https://www.doxygen.nl/files" ;\
FILE="doxygen-${DOXYGEN_RELEASE}.src.tar.gz" ;\
wget ${DIST}/${FILE} ;\
tar -xzf ${FILE} ;\
cd doxygen-${DOXYGEN_RELEASE} ;\
cmake -B build -S . \
-DCMAKE_BUILD_TYPE=Release ;\
cmake --build build/ ;\
cmake --build build/ --target install ;\
cd .. ;\
rm -rf ${FILE} doxygen-${DOXYGEN_RELEASE}
ARG ZNAI_RELEASE=1.91
RUN set -ex ;\
: "${ZNAI_RELEASE:?ZNAI_RELEASE is not set}" ;\
DIST="https://repo.maven.apache.org/maven2/org/testingisdocumenting/znai/znai-dist" ;\
FILE=znai-dist-${ZNAI_RELEASE}-znai.zip ;\
wget ${DIST}/${ZNAI_RELEASE}/${FILE} ;\
unzip ${FILE} -d znai_tmp ;\
mv znai_tmp/dist /opt/znai ;\
rm -rf ${FILE} znai_tmp
ENV PATH=${PATH}:/opt/znai
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
# Clang 15 is not available in Debian bookworm, but the following lines can be used to install it if needed.
# RUN set -ex ;\
# export DEBIAN_FRONTEND=noninteractive ;\
# CODENAME=$( . /etc/os-release && echo $VERSION_CODENAME ) ;\
# printf "%s\n%s\n" \
# "deb [signed-by=/etc/apt/keyrings/llvm.gpg] https://apt.llvm.org/${CODENAME}/ llvm-toolchain-${CODENAME}-15 main" \
# "deb-src [signed-by=/etc/apt/keyrings/llvm.gpg] https://apt.llvm.org/${CODENAME}/ llvm-toolchain-${CODENAME}-15 main" \
# | tee /etc/apt/sources.list.d/llvm-15.list ;\
# apt-get update ;\
# apt-get install -t llvm-toolchain-${CODENAME}-15 -y --no-install-recommends \
# clang-15 clang++-15 clang-tools-15 clang-tidy-15 clang-format-15 \
# clangd-15 llvm-15 ;\
# apt-get clean && rm -rf /var/lib/apt/lists/*
RUN cp /etc/zsh/newuser.zshrc.recommended .zshrc ;\
touch .zshrc.local ;\
ln -s .profile .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