-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
68 lines (56 loc) · 2.34 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
# -----------------------------------------------------------
# Base Image with LLVM
# -----------------------------------------------------------
FROM ubuntu:22.04 as ubuntu_llvm
ENV DEBIAN_FRONTEND=noninteractive
# update the system and install any dependencies
RUN apt-get update \
&& apt-get upgrade -y libksba-dev \
&& apt-get install -y software-properties-common \
&& add-apt-repository ppa:deadsnakes/ppa\
&& apt-get install -y git cmake build-essential byacc libpcre3 libpcre3-dev grep lsb-release wget gnupg libcurl4-openssl-dev unzip lcov python3.11 --no-install-recommends # skipcq: DOK-DL3018
# Get LLVM
ARG LLVM_VER=16
RUN wget --no-verbose https://apt.llvm.org/llvm.sh
RUN chmod +x ./llvm.sh \
&& ./llvm.sh ${LLVM_VER} \
&& apt-get -y install libclang-${LLVM_VER}-dev libclang-cpp${LLVM_VER}-dev --no-install-recommends \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* \
&& ln -s /usr/lib/x86_64-linux-gnu/libclang-16.so.16.0.6 /usr/lib/x86_64-linux-gnu/libclang-16.so.16
# Add environment variables for build
ENV PATH="$PATH:/usr/lib/llvm-${LLVM_VER}/bin"
ENV LLVM_INSTALL_DIR "/usr/lib/llvm-${LLVM_VER}"
ENV SENTRY_INSTALL_DIR="/usr/lib/sentry-sdk"
# Get Sentry
ARG SENTRY_TAG=0.6.3
RUN mkdir /sentry-sdk \
&& cd /sentry-sdk \
&& wget --no-verbose "https://github.com/getsentry/sentry-native/releases/download/${SENTRY_TAG}/sentry-native.zip" \
&& unzip sentry-native.zip \
&& cmake -B ./build \
&& cmake --build ./build --parallel \
&& cmake --install ./build --prefix "${SENTRY_INSTALL_DIR}"
# Install spdlog
RUN git clone --depth=1 --branch v1.11.0 https://github.com/gabime/spdlog.git \
&& cd spdlog \
&& cmake -B build \
&& cmake --build build --parallel \
&& cd build && make install
# Install cppcheck
RUN git clone --depth=1 --branch 2.10.3 https://github.com/danmar/cppcheck.git \
&& cd cppcheck \
&& cmake -B build -DHAVE_RULES=ON -DUSE_MATCHCOMPILER=ON -DCMAKE_BUILD_TYPE=RELEASE \
&& cmake --build build --parallel 4 \
&& cd build && make install
# -----------------------------------------------------------
# End
# -----------------------------------------------------------
FROM rust:slim-bookworm AS rs_builder
RUN mkdir -p /code
ADD . /code
WORKDIR /code
RUN cargo b --release
FROM ubuntu_llvm
RUN mkdir -p /toolbox
COPY --from=rs_builder /code/target/release/cppcheck-deepsource /toolbox/