forked from mchalupa/dg
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
51 lines (40 loc) · 1.4 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
# --------------------------------------------------
# Base container
# --------------------------------------------------
FROM docker.io/ubuntu:jammy AS base
RUN set -e
# Install packages
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update
RUN apt-get install -yq --no-install-recommends clang llvm
# --------------------------------------------------
# Build container
# --------------------------------------------------
FROM base as build
# Can be used to specify which git ref to checkout
ARG GIT_REF=master
ARG GIT_REPO=mchalupa/dg
# Install build dependencies
RUN apt-get install -yq --no-install-recommends ca-certificates cmake git \
ninja-build llvm-dev python3
# Clone
RUN git clone https://github.com/$GIT_REPO
WORKDIR /dg
RUN git fetch origin $GIT_REF:build
RUN git checkout build
# libfuzzer does not like the container environment
RUN cmake -S. -GNinja -Bbuild -DCMAKE_INSTALL_PREFIX=/opt/dg \
-DCMAKE_CXX_COMPILER=clang++ -DENABLE_FUZZING=OFF
RUN cmake --build build
RUN cmake --build build --target check
# Install
RUN cmake --build build --target install/strip
# -------------------------------------------------
# Release container
# -------------------------------------------------
FROM base AS release
COPY --from=build /opt/dg /opt/dg
ENV PATH="/opt/dg/bin:$PATH"
ENV LD_LIBRARY_PATH="/opt/dg/lib"
# Verify it works
RUN llvm-slicer --version