-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathwork-base.Dockerfile
More file actions
290 lines (247 loc) · 9.92 KB
/
Copy pathwork-base.Dockerfile
File metadata and controls
290 lines (247 loc) · 9.92 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
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
ARG UBUNTU_VERSION=22.04
ARG UBUNTU_NAME=jammy
ARG DEBIAN_FRONTEND="noninteractive"
# ==========================================================
# stage 0
FROM ubuntu:${UBUNTU_VERSION} AS builder
ARG UBUNTU_NAME
ARG DEBIAN_FRONTEND
RUN apt-get update && \
apt-get install -y software-properties-common gpg-agent && \
apt-get install -y gcc-11 libgccjit-11-dev && \
apt-add-repository ppa:ubuntu-toolchain-r/test && \
apt-get update && \
apt-get install -y \
git \
autoconf \
texinfo \
binutils \
flex \
bison \
libmpc-dev \
libmpfr-dev \
libgmp-dev \
coreutils \
make \
libtinfo5 \
texinfo \
libxpm-dev \
libgnutls28-dev \
libncurses5-dev \
libxml2-dev \
libxt-dev \
gcc-multilib \
librsvg2-dev \
libsqlite3-dev \
gcc-13 g++-13 \
&& \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
RUN git config --global http.sslVerify false
# ============================================================
# https://www.masteringemacs.org/article/speed-up-emacs-libjansson-native-elisp-compilation
# https://gitlab.com/koral/emacs-nativecomp-dockerfile/-/blob/master/Dockerfile
RUN apt-get update \
&& apt-get install -y \
apt-transport-https \
ca-certificates \
curl \
# other package needed
wget \
unzip
# install tree-sitter
# https://www.reddit.com/r/emacs/comments/z25iyx/comment/ixll68j/?utm_source=share&utm_medium=web2x&context=3
ARG CC="gcc-11" CFLAGS="-O3 -Wall -Wextra"
RUN git clone --depth 1 --branch v0.26.9 https://github.com/tree-sitter/tree-sitter.git /opt/tree-sitter && \
cd /opt/tree-sitter && \
make -j4 && \
make install
RUN ldconfig
ARG CFLAGS="-O2"
RUN git clone --depth 1 --branch emacs-31 https://github.com/emacs-mirror/emacs /opt/emacs && \
cd /opt/emacs && \
# git checkout c6bdfaf358e25d7e30162d378dab9bb75e1220c2 && \
./autogen.sh && \
./configure --build="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \
--with-modules \
--with-native-compilation \
--with-tree-sitter \
--with-sqlite3 \
--with-gif=ifavailable \
--with-jpeg=ifavailable \
--with-tiff=ifavailable \
# no need GUI and silent the `--with-x-toolkit=lucid` warning.
--without-x --without-x-toolkit-scroll-bars \
--prefix=/usr/local && \
make NATIVE_FULL_AOT=1 -j30 && \
make install-strip && \
rm -r /opt/emacs
# ============================================================
# tree-sitter-language
# https://github.com/orzechowskid/emacs-docker/blob/main/src/build-ts-modules.sh
# https://github.com/emacs-mirror/emacs/tree/master/admin/notes/tree-sitter
# https://emacs-china.org/t/treesit-master/22862/69
RUN apt-get update && \
apt-get install -y g++ && \
git clone --branch v2.5 https://github.com/casouri/tree-sitter-module /opt/tree-sitter-module && \
cd /opt/tree-sitter-module && \
sed -i "/languages=(/a \ \ \ \ 'jsdoc'" batch.sh && \
./batch.sh && \
mv ./dist/* /usr/local/lib/ && \
cd /opt/
# ============================================================
# Install GDB
# https://www.linuxfromscratch.org/blfs/view/svn/general/gdb.html
ENV GDB_VERSION 17.2
RUN apt-get update && \
apt-get install -y python3-dev libmpfr-dev libgmp-dev libreadline-dev && \
wget https://sourceware.org/pub/gdb/releases/gdb-${GDB_VERSION}.tar.gz && \
tar -xf gdb-${GDB_VERSION}.tar.gz && \
cd gdb-${GDB_VERSION} && \
./configure --with-python=/usr/bin/python3 --prefix=/usr/local --with-system-readline && \
make -j30 && make install
# ============================================================
# https://github.com/nodejs/docker-node
ENV NODE_VERSION 24.18.0
RUN apt-get update && \
apt-get install xz-utils && \
curl -fsSLOk --compressed "https://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION-linux-x64.tar.xz" \
&& tar -xJf "node-v$NODE_VERSION-linux-x64.tar.xz" -C /usr/local --strip-components=1 --no-same-owner \
&& rm /usr/local/*.md /usr/local/LICENSE \
&& rm "node-v$NODE_VERSION-linux-x64.tar.xz" \
&& ln -s /usr/local/bin/node /usr/local/bin/nodejs \
# smoke tests
&& node --version \
&& npm --version \
# install some LSP servers
# && npm config set registry https://registry.npm.taobao.org \
&& npm i --location=global typescript typescript-language-server \
&& npm i --location=global bash-language-server \
&& npm i --location=global pyright \
&& npm i --location=global dockerfile-language-server-nodejs \
&& npm i --location=global vscode-langservers-extracted \
&& npm i --location=global yaml-language-server \
&& npm i --location=global markdownlint-cli
# ============================================================
# https://hub.docker.com/r/rikorose/gcc-cmake/dockerfile
ENV CMAKE_VERSION 4.1.0
RUN wget https://github.com/Kitware/CMake/releases/download/v$CMAKE_VERSION/cmake-$CMAKE_VERSION-linux-x86_64.sh \
--no-check-certificate \
-q -O /tmp/cmake-install.sh \
&& chmod u+x /tmp/cmake-install.sh \
&& /tmp/cmake-install.sh --skip-license --prefix=/usr/local \
&& rm /tmp/cmake-install.sh
# ============================================================
# Build Aspell
# https://github.com/Starefossen/docker-aspell
ENV ASPELL_SERVER http://mirror.keystealth.org/gnu/aspell
ENV ASPELL_VERSION 0.60.8.1
ENV ASPELL_EN 2020.12.07-0
RUN apt-get install -y bzip2 && \
ldconfig
RUN wget "${ASPELL_SERVER}/aspell-${ASPELL_VERSION}.tar.gz" \
&& wget "${ASPELL_SERVER}/dict/en/aspell6-en-${ASPELL_EN}.tar.bz2" \
&& tar -xzf "aspell-${ASPELL_VERSION}.tar.gz" \
&& tar -xjf "aspell6-en-${ASPELL_EN}.tar.bz2" \
# build
&& cd "/aspell-${ASPELL_VERSION}" \
&& ./configure \
&& make -j4 \
&& make install \
&& ldconfig \
# copy
&& cd "/aspell6-en-${ASPELL_EN}" \
&& ./configure \
&& make -j4 \
&& make install
# ============================================================
# Build libEnchant for jinx
ENV ENCHANT_VERSION 2.6.9
RUN apt-get update && apt-get install -y libglib2.0-dev groff && \
wget "https://github.com/rrthomas/enchant/releases/download/v${ENCHANT_VERSION}/enchant-${ENCHANT_VERSION}.tar.gz" \
&& tar -xf "enchant-${ENCHANT_VERSION}.tar.gz" \
# build
&& cd "enchant-${ENCHANT_VERSION}" \
&& test -f configure \
&& ./configure \
&& make \
&& make install \
&& ldconfig
# ============================================================
# https://hub.docker.com/r/peccu/rg/dockerfile
# build ripgrep
ENV RG_VERSION=15.1.0
RUN set -x \
&& wget https://github.com/BurntSushi/ripgrep/releases/download/${RG_VERSION}/ripgrep-${RG_VERSION}-x86_64-unknown-linux-musl.tar.gz \
--no-check-certificate \
&& tar xzf ripgrep-${RG_VERSION}-x86_64-unknown-linux-musl.tar.gz \
&& mv ripgrep-${RG_VERSION}-x86_64-unknown-linux-musl/rg /usr/local/bin/
# ============================================================
# get jq
ENV JQ_VERSION=1.8.1
RUN set -x \
&& wget https://github.com/jqlang/jq/releases/download/jq-${JQ_VERSION}/jq-linux-amd64 \
--no-check-certificate -O jq \
&& chmod +x ./jq \
&& mv ./jq /usr/local/bin/
# ============================================================
# build fd-find
ENV FD_VERSION=10.4.2
RUN set -x \
&& wget https://github.com/sharkdp/fd/releases/download/v${FD_VERSION}/fd-v${FD_VERSION}-x86_64-unknown-linux-gnu.tar.gz \
--no-check-certificate \
&& tar xzf fd-v${FD_VERSION}-x86_64-unknown-linux-gnu.tar.gz \
&& mv fd-v${FD_VERSION}-x86_64-unknown-linux-gnu/fd /usr/local/bin/
# ============================================================
# other scripts
RUN mkdir /usr/local/share/bash-color
COPY scripts/terminfo-24bit.src /usr/local/share/bash-color/
# ============================================================
# download latest shfmt
ENV SHFMT_VERSION=3.13.1
RUN wget https://github.com/mvdan/sh/releases/download/v${SHFMT_VERSION}/shfmt_v${SHFMT_VERSION}_linux_amd64 && \
mv shfmt*linux_amd64 shfmt && \
chmod +x ./shfmt && \
cp ./shfmt /usr/local/bin/
# ==========================================================
# install rust-analyzer
RUN curl -L https://github.com/rust-analyzer/rust-analyzer/releases/latest/download/rust-analyzer-x86_64-unknown-linux-gnu.gz | gunzip -c - > /usr/local/bin/rust-analyzer \
&& chmod +x /usr/local/bin/rust-analyzer
# ==========================================================
# install mosh
RUN apt-get update && \
apt-get install -y \
automake \
pkg-config protobuf-compiler libprotobuf-dev libutempter-dev zlib1g-dev libncurses5-dev \
libssl-dev bash-completion tmux less && \
# https://github.com/mobile-shell/mosh/issues/1134
git clone --branch=mosh-1.4.0+blink-17.3.0 https://github.com/blinksh/mosh-server && \
cd mosh-server && \
./autogen.sh && \
./configure && \
make && make install
# ==========================================================
# install uv
RUN curl -L https://github.com/astral-sh/uv/releases/latest/download/uv-x86_64-unknown-linux-musl.tar.gz \
| tar -xz -C /usr/local/bin --strip-components=1
# ==========================================================
# install pixi
RUN curl -L https://github.com/prefix-dev/pixi/releases/latest/download/pixi-x86_64-unknown-linux-musl.tar.gz \
| tar -xz -C /usr/local/bin
# ==========================================================
# install llvm tools
ENV LLVM_VERSION=22.1.8
RUN cd /opt/ && rm -rf /opt/* /tmp/* && \
wget https://github.com/llvm/llvm-project/releases/download/llvmorg-${LLVM_VERSION}/LLVM-${LLVM_VERSION}-Linux-X64.tar.xz && \
tar xf LLVM-${LLVM_VERSION}-Linux-X64.tar.xz && \
cd LLVM-${LLVM_VERSION}-Linux-X64/bin && \
cp llvm-cxxfilt llvm-symbolizer /usr/local/bin/ && \
cp *lsp-server /usr/local/bin/ && \
rm -r /opt/*
# ==========================================================
# stage 1
FROM ubuntu:${UBUNTU_VERSION} AS release
ARG UBUNTU_NAME
ARG DEBIAN_FRONTEND
RUN rm -rf /usr/local/man
COPY --from=builder /usr/local /usr/local