-
Notifications
You must be signed in to change notification settings - Fork 6
/
Dockerfile
89 lines (80 loc) · 2.53 KB
/
Dockerfile
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
#######################################
# CI image:
# the one used by your CI server
#######################################
FROM ubuntu:20.04 as docker4c_ci_image
ARG DEBIAN_FRONTEND=noninteractive
ARG CLANG_VERSION=12
# fix "Missing privilege separation directory":
# https://bugs.launchpad.net/ubuntu/+source/openssh/+bug/45234
RUN mkdir -p /run/sshd && \
apt-get update && apt-get -y dist-upgrade && \
apt-get -y install --fix-missing \
build-essential \
bzip2 \
ccache \
clang-${CLANG_VERSION} \
clangd-${CLANG_VERSION} \
clang-format-${CLANG_VERSION} \
clang-tidy-${CLANG_VERSION} \
cmake \
cppcheck \
curl \
doxygen \
gcovr \
git \
graphviz \
libclang-${CLANG_VERSION}-dev \
linux-tools-generic \
lldb-${CLANG_VERSION} \
lld-${CLANG_VERSION} \
lsb-release \
ninja-build \
python3 \
python3-pip \
shellcheck \
software-properties-common \
ssh \
sudo \
tar \
unzip \
valgrind \
wget && \
\
pip install behave conan pexpect requests && \
apt-get autoremove -y && apt-get clean && \
\
for c in $(ls /usr/bin/clang*-${CLANG_VERSION}); do link=$(echo $c | sed "s/-${CLANG_VERSION}//"); ln -sf $c $link; done && \
update-alternatives --install /usr/bin/cc cc /usr/bin/clang 1000 && \
update-alternatives --install /usr/bin/c++ c++ /usr/bin/clang++ 1000
# build include-what-you-use in the version that matches CLANG_VERSION (iwyu branch name)
WORKDIR /var/tmp/build_iwyu
RUN curl -sSL https://github.com/include-what-you-use/include-what-you-use/archive/refs/heads/clang_${CLANG_VERSION}.zip -o temp.zip && \
unzip temp.zip && rm temp.zip && mv include-what-you-use-clang_${CLANG_VERSION}/* . && rm -r include-what-you-use-clang_${CLANG_VERSION} && \
cmake -DCMAKE_INSTALL_PREFIX=/usr -Bcmake-build && \
cmake --build cmake-build --target install -- -j ${NCPU} && \
ldconfig
WORKDIR /
RUN rm -rf /var/tmp/build_iwyu
#######################################
# DEV image:
# the one you run locally
#######################################
FROM docker4c_ci_image as docker4c_dev_image
RUN apt-get -y install --fix-missing \
cmake-curses-gui \
gdb \
gdbserver \
python-is-python3 \
vim \
&& apt-get autoremove -y && apt-get clean && \
\
groupadd -g 1000 dev && \
useradd -m -u 1000 -g 1000 -d /home/dev -s /bin/bash dev && \
usermod -a -G adm,cdrom,sudo,dip,plugdev dev && \
echo 'dev:dev' | chpasswd && \
echo "dev ALL=(ALL:ALL) ALL" >> /etc/sudoers
USER dev
WORKDIR /home/dev
RUN sed -i 's/\\h/docker/;s/01;32m/01;33m/' /home/dev/.bashrc \
&& mkdir -p /home/dev/git