1+ ARG OS=ubuntu
2+ ARG TAG=hirsute
3+
4+ FROM ${OS}:${TAG} as base
5+
6+ # Install required packages
7+ ARG CLANG_VER=12
8+ ARG GCC_VER=11
9+ RUN apt update
10+ RUN export DEBIAN_FRONTEND=noninteractive \
11+ && apt install -y git htop sudo curl wget net-tools jq \
12+ build-essential cmake ninja-build valgrind gdb doxygen \
13+ clang-${CLANG_VER} clang-tidy-${CLANG_VER} clang-format-${CLANG_VER} clang-tools-${CLANG_VER} \
14+ gcc-${GCC_VER} g++-${GCC_VER} \
15+ python3 python3-pip
16+
17+ # Set selected clang version as default
18+ RUN ln -s /usr/bin/clang-${CLANG_VER} /usr/bin/clang \
19+ && ln -s /usr/bin/clang-tidy-${CLANG_VER} /usr/bin/clang-tidy \
20+ && ln -s /usr/bin/clang-format-${CLANG_VER} /usr/bin/clang-format \
21+ && ln -s /usr/bin/scan-build-${CLANG_VER} /usr/bin/scan-build \
22+ && ln -s /usr/bin/run-clang-tidy-${CLANG_VER} /usr/bin/run-clang-tidy \
23+ && ln -s /usr/bin/clang-apply-replacements-${CLANG_VER} /usr/bin/clang-apply-replacements
24+
25+ # Setup user and shell
26+ ARG INSTALL_ZSH="false"
27+ ARG USERNAME=vscode
28+ ARG USER_UID=1000
29+ ARG USER_GID=$USER_UID
30+ COPY setup.sh /tmp
31+ RUN /tmp/setup.sh "${INSTALL_ZSH}" "${USERNAME}" "${USER_UID}" "${USER_GID}" "true" \
32+ && rm -f /tmp/setup.sh
33+ # ################################################################################################
34+ FROM base as codechecker-builder
35+
36+ RUN export DEBIAN_FRONTEND=noninteractive \
37+ && apt install -y python3-dev python3-venv nodejs npm
38+ RUN git clone https://github.com/Ericsson/CodeChecker.git --depth 1 /codechecker
39+ SHELL ["/bin/bash" , "-c" ]
40+ ENV BUILD_LOGGER_64_BIT_ONLY=YES
41+ RUN cd /codechecker \
42+ && npm install -g node-gyp \
43+ && make venv \
44+ && source $PWD/venv/bin/activate \
45+ && make package
46+
47+ # ################################################################################################
48+ FROM base
49+
50+ # Setup CodeChecker
51+ COPY --from=codechecker-builder /codechecker/build/CodeChecker /opt/codechecker
52+ COPY --from=codechecker-builder /codechecker/analyzer/requirements.txt /opt/codechecker
53+ RUN pip3 install -r /opt/codechecker/requirements.txt \
54+ && ln -s /opt/codechecker/bin/CodeChecker /usr/bin/CodeChecker
55+
56+ # Setup cmake utils
57+ COPY .CodeCheckerIgnore utils.cmake /opt/cmake-utils/
58+
59+ # Cleanup
60+ RUN export DEBIAN_FRONTEND=noninteractive && apt autoremove -y
0 commit comments