-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathDockerfile.ubuntu
146 lines (134 loc) · 3.96 KB
/
Dockerfile.ubuntu
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
FROM nvcr.io/nvidia/cuda:12.3.2-devel-ubuntu22.04
MAINTAINER Yousong Zhou <[email protected]>
ARG DEBIAN_FRONTEND=noninteractive
# python3-dev: ycmd build
# hostname: for hostname command
#
# Remove dpkg.cfg.d/excludes so that unminimize will not do reinstallation for
# adding manpages. Reinstall can cause upgrade of certain packages like
# libnvinfer7 to make it depend on libnvrtc.so.11.1 instead of libnvrt.so.11.0
#
# USERGROUPS_ENAB no: su command reads it and when it's yes the umask will be
# changed from 022 to 002. Oh-my-zsh does not like it and require us to fix it by
#
# compaudit | xargs chmod g-w,o-w
#
# ubuntu uses dash as /bin/sh and it does not work well with dconf.sh
# https://wiki.ubuntu.com/DashAsBinSh
RUN set -x \
&& rm -vf /etc/dpkg/dpkg.cfg.d/excludes \
&& yes | unminimize \
&& sed -i 's:^USERGROUPS_ENAB .*:USERGROUPS_ENAB no:g' /etc/login.defs \
&& ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
&& apt-get update \
&& apt-get install -y --no-install-recommends \
build-essential \
cmake \
universal-ctags \
curl \
docker.io \
file \
git \
git-email \
hostname \
iproute2 \
iputils-arping \
iputils-clockdiff \
iputils-ping \
iputils-tracepath \
jq \
less \
locales \
lsof \
man-db \
mariadb-client \
nftables \
openssh-client \
patch \
procps \
python3-dev \
rsync \
strace \
sudo \
sysstat \
tcpdump \
tmux \
vim \
wget \
zsh \
&& apt-get install -y --no-install-recommends \
libcublas-dev-12-3 \
libcudnn9-dev-cuda-12 \
libcufft-dev-12-3 \
libcufile-dev-12-3 \
libcurand-dev-12-3 \
libcusolver-dev-12-3 \
libcusparse-dev-12-3 \
libcutensor-dev \
&& echo "dash dash/sh boolean false" | debconf-set-selections \
&& dpkg-reconfigure dash \
&& sed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen \
&& locale-gen \
&& true
RUN set -x \
&& apt-get install -y --no-install-recommends \
python3-pip \
&& pip3 install https://github.com/yousong/polysh/archive/7fc055ef9075e5dbee4cc7abc020b89fccabfc67.zip \
&& pip3 install \
yq \
&& true
# We use repo settings in the build machine for installing packages. The built
# image is mostly to be used where aliyun mirrors is the faster accessible
RUN set -x \
&& sed -i 's:archive.ubuntu.com:mirrors.aliyun.com:g' /etc/apt/sources.list \
&& sed -i 's:security.ubuntu.com:mirrors.aliyun.com:g' /etc/apt/sources.list \
&& true
RUN set -x \
&& adduser --shell /bin/zsh abc \
&& echo "abc ALL=(ALL) NOPASSWD: ALL" >/etc/sudoers.d/abc \
&& true
RUN set -x \
&& mkdir -p /home/abc/.usr/n \
&& curl -o n -L "https://raw.githubusercontent.com/tj/n/master/bin/n" \
&& N_PREFIX=/home/abc/.usr bash n lts \
&& rm -vf n \
&& chown -R abc:abc /home/abc/.usr \
&& true
ARG GOVERSION=go1.22.1
ARG GOURL=https://storage.googleapis.com/golang/$GOVERSION.linux-amd64.tar.gz
RUN set -x \
&& mkdir -p /home/abc/.usr/go \
&& cd /home/abc/.usr/go \
&& curl -L "$GOURL" \
| tar xzf - \
&& chmod -R a-w go \
&& mv go $GOVERSION \
&& chown -R abc:abc /home/abc/.usr/go \
&& true
RUN set -x \
&& cd /home/abc \
&& curl https://sh.rustup.rs -sSf \
| sudo -u abc sh -s -- --no-modify-path --default-toolchain stable -y \
&& sudo -u abc /home/abc/.cargo/bin/rustup component list --installed \
| grep docs \
| xargs sudo -u abc /home/abc/.cargo/bin/rustup component remove \
&& sudo -u abc /home/abc/.cargo/bin/cargo install ripgrep \
&& rm -rf /home/abc/.cargo/registry \
&& true
ADD . /home/abc/git-repo/dconf
RUN set -x \
&& cd /home/abc/git-repo/dconf \
&& chown -R abc:abc /home/abc/git-repo \
&& sudo -u abc \
PATH=/home/abc/.usr/bin:$PATH \
./dconf.sh config \
&& cd /home/abc \
&& rm -rf git-repo \
&& sudo -iu abc PATH=/home/abc/.usr/go/$GOVERSION/bin:$PATH \
vim +GoInstallBinaries +qa \
&& /home/abc/go/bin/gopls version \
&& rm -rf /home/abc/.cache/go-build \
&& true
ADD ./hack/docker/run.sh /run.sh
CMD /run.sh entrypoint
# vi: ft=dockerfile