-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
77 lines (64 loc) · 3.32 KB
/
Copy pathDockerfile
File metadata and controls
77 lines (64 loc) · 3.32 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
# =============================================================================
# NIKOS Docker image
# =============================================================================
# The first stage builds NIKOS from the sources of this checkout; the second
# stage copies the install tree into a runtime image with clang-20.
#
# Usage:
# docker build -t nikos .
# docker run --rm -v "$(pwd)":/work nikos /work/example.c
#
# See doc/DOCKER.md.
# =============================================================================
# ---------------------------------------------------------------------------
# Stage 1: build
# ---------------------------------------------------------------------------
FROM ubuntu:24.04 AS builder
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential cmake wget gnupg ca-certificates \
libboost-dev libboost-filesystem-dev libboost-thread-dev libboost-test-dev \
libgmp-dev libsqlite3-dev libtbb-dev libedit-dev zlib1g-dev libzstd-dev \
nlohmann-json3-dev python3 python3-pip python3-venv \
&& wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key \
| gpg --dearmor -o /usr/share/keyrings/llvm-archive-keyring.gpg \
&& echo "deb [signed-by=/usr/share/keyrings/llvm-archive-keyring.gpg] http://apt.llvm.org/noble/ llvm-toolchain-noble-20 main" \
> /etc/apt/sources.list.d/llvm-20.list \
&& apt-get update && apt-get install -y --no-install-recommends \
llvm-20 llvm-20-dev llvm-20-tools clang-20 libclang-20-dev \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /src
COPY . /src/
RUN cmake -S /src -B /src/build \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/opt/nikos \
-DLLVM_CONFIG_EXECUTABLE=/usr/lib/llvm-20/bin/llvm-config \
&& cmake --build /src/build -j"$(nproc)" \
&& cmake --build /src/build --target install
# ---------------------------------------------------------------------------
# Stage 2: runtime
# ---------------------------------------------------------------------------
FROM ubuntu:24.04 AS runtime
LABEL org.opencontainers.image.title="NIKOS" \
org.opencontainers.image.description="Static analyzer for C and C++ based on abstract interpretation (LLVM 20)" \
org.opencontainers.image.source="https://github.com/alternative-intelligence-cp/nikos" \
org.opencontainers.image.licenses="NOSA-1.3"
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y --no-install-recommends \
wget gnupg ca-certificates \
&& wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key \
| gpg --dearmor -o /usr/share/keyrings/llvm-archive-keyring.gpg \
&& echo "deb [signed-by=/usr/share/keyrings/llvm-archive-keyring.gpg] http://apt.llvm.org/noble/ llvm-toolchain-noble-20 main" \
> /etc/apt/sources.list.d/llvm-20.list \
&& apt-get update && apt-get install -y --no-install-recommends \
clang-20 llvm-20 python3 \
libboost-filesystem1.83.0 libboost-thread1.83.0 libboost-atomic1.83.0 \
libgmp10 libgmpxx4ldbl libsqlite3-0 libtbb12 zlib1g libzstd1 \
&& rm -rf /var/lib/apt/lists/*
COPY --from=builder /opt/nikos /opt/nikos
ENV PATH="/opt/nikos/bin:${PATH}"
WORKDIR /work
# The entry point is the ikos driver; use --entrypoint ikos-analyzer to run the
# analyzer on bitcode you compiled yourself.
ENTRYPOINT ["ikos"]
CMD ["--help"]