-
Notifications
You must be signed in to change notification settings - Fork 61
/
Dockerfile
203 lines (183 loc) · 7.92 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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
# ------------------------------------------------------------------------------
# Install Souffle
# ------------------------------------------------------------------------------
FROM ubuntu:20.04 AS souffle
RUN export DEBIAN_FRONTEND=noninteractive
RUN ln -fs /usr/share/zoneinfo/America/New_York /etc/localtime
RUN apt-get -y update \
&& apt-get -y install \
automake \
bison \
build-essential \
cmake \
doxygen \
flex \
git \
libffi-dev \
libsqlite3-dev \
libtool \
lsb-release \
mcpp \
sqlite3 \
zlib1g-dev
RUN git clone -b 2.4 https://github.com/souffle-lang/souffle && \
cd souffle && \
cmake . -Bbuild -DCMAKE_BUILD_TYPE=Release -DSOUFFLE_USE_CURSES=0 -DSOUFFLE_USE_SQLITE=0 -DSOUFFLE_DOMAIN_64BIT=1 && \
cd build && \
make install -j4
# ------------------------------------------------------------------------------
# Install LIEF
# ------------------------------------------------------------------------------
FROM ubuntu:20.04 AS LIEF
RUN export DEBIAN_FRONTEND=noninteractive
RUN ln -fs /usr/share/zoneinfo/America/New_York /etc/localtime
RUN apt-get -y update \
&& apt-get -y install \
build-essential \
cmake \
git \
python3
RUN git clone -b 0.13.2 --depth 1 https://github.com/lief-project/LIEF.git /usr/local/src/LIEF
RUN cmake -DLIEF_PYTHON_API=OFF -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF /usr/local/src/LIEF -B/usr/local/src/LIEF/build
RUN cmake --build /usr/local/src/LIEF/build -j4 --target all install
# ------------------------------------------------------------------------------
# Install libehp
# ------------------------------------------------------------------------------
FROM ubuntu:20.04 AS libehp
RUN export DEBIAN_FRONTEND=noninteractive
RUN ln -fs /usr/share/zoneinfo/America/New_York /etc/localtime
RUN apt-get -y update \
&& apt-get -y install \
build-essential \
cmake \
git
RUN git clone https://github.com/GrammaTech/libehp.git /usr/local/src/libehp
RUN git -C /usr/local/src/libehp reset --hard 5e41e26b88d415f3c7d3eb47f9f0d781cc519459
RUN cmake -DCMAKE_CXX_COMPILER=g++ -DCMAKE_BUILD_TYPE=Release -DEHP_BUILD_SHARED_LIBS=OFF /usr/local/src/libehp -B/usr/local/src/libehp/build
RUN cmake --build /usr/local/src/libehp/build -j4 --target all install
# ------------------------------------------------------------------------------
# Install GTIRB
# ------------------------------------------------------------------------------
FROM ubuntu:20.04 AS gtirb
RUN export DEBIAN_FRONTEND=noninteractive
RUN ln -fs /usr/share/zoneinfo/America/New_York /etc/localtime
RUN apt-get -y update \
&& apt-get -y install \
cmake \
build-essential \
protobuf-compiler \
libboost-filesystem-dev \
libboost-filesystem1.71.0 \
python3 \
git
ARG GTIRB_BRANCH=master
ARG GTIRB_CACHE_KEY
RUN git clone --depth=1 -b $GTIRB_BRANCH https://github.com/GrammaTech/gtirb /usr/local/src/gtirb
RUN cmake -DGTIRB_JAVA_API=OFF -DGTIRB_CL_API=OFF /usr/local/src/gtirb -B/usr/local/src/gtirb/build
RUN cmake --build /usr/local/src/gtirb/build -j4 --target all install
# ------------------------------------------------------------------------------
# Install gtirb-pprinter
# ------------------------------------------------------------------------------
FROM ubuntu:20.04 AS gtirb-pprinter
RUN export DEBIAN_FRONTEND=noninteractive
RUN ln -fs /usr/share/zoneinfo/America/New_York /etc/localtime
RUN apt-get -y update \
&& apt-get -y install \
cmake \
build-essential \
protobuf-compiler \
libboost-filesystem-dev \
libboost-filesystem1.71.0 \
libboost-system-dev \
libboost-system1.71.0 \
libboost-program-options-dev \
libboost-program-options1.71.0 \
python3 \
git \
wget
RUN wget https://download.grammatech.com/gtirb/files/apt-repo/pool/unstable/libc/libcapstone-dev/libcapstone-dev_5.0.1_gtdev_amd64.deb \
&& dpkg -i libcapstone-dev_*_amd64.deb \
&& rm libcapstone-dev_*_amd64.deb
COPY --from=gtirb /usr/local/lib /usr/local/lib
COPY --from=gtirb /usr/local/include /usr/local/include
ARG GTIRB_PPRINTER_BRANCH=master
ARG GTIRB_PPRINTER_CACHE_KEY
RUN git clone --depth 1 -b $GTIRB_PPRINTER_BRANCH https://github.com/GrammaTech/gtirb-pprinter /usr/local/src/gtirb-pprinter
RUN cmake /usr/local/src/gtirb-pprinter -B/usr/local/src/gtirb-pprinter/build
RUN cmake --build /usr/local/src/gtirb-pprinter/build -j4 --target all install
# ------------------------------------------------------------------------------
# Install Ddisasm
# ------------------------------------------------------------------------------
FROM ubuntu:20.04 AS ddisasm
RUN export DEBIAN_FRONTEND=noninteractive
RUN ln -fs /usr/share/zoneinfo/America/New_York /etc/localtime
RUN apt-get -y update \
&& apt-get -y install \
build-essential \
clang \
cmake \
g++ \
git \
lib32gcc-9-dev \
lib32stdc++-9-dev \
libboost-filesystem-dev \
libboost-filesystem1.71.0 \
libboost-program-options-dev \
libboost-program-options1.71.0 \
libboost-system-dev \
libboost-system1.71.0 \
libc-dev-i386-cross \
mcpp \
pandoc \
protobuf-compiler \
python3 \
wget
RUN wget https://download.grammatech.com/gtirb/files/apt-repo/pool/unstable/libc/libcapstone-dev/libcapstone-dev_5.0.1_gtdev_amd64.deb \
&& dpkg -i libcapstone-dev_*_amd64.deb \
&& rm libcapstone-dev_*_amd64.deb
COPY --from=souffle /usr/local/bin/souffle* /usr/local/bin/
COPY --from=souffle /usr/local/include /usr/local/include
COPY --from=LIEF /usr/lib/libLIEF.a /usr/lib/libLIEF.a
COPY --from=LIEF /usr/include/LIEF /usr/include/LIEF
COPY --from=LIEF /usr/share/LIEF /usr/share/LIEF
COPY --from=libehp /usr/local/lib /usr/local/lib
COPY --from=libehp /usr/local/include /usr/local/include
COPY --from=gtirb /usr/local/lib /usr/local/lib
COPY --from=gtirb /usr/local/include /usr/local/include
COPY --from=gtirb-pprinter /usr/local/bin/gtirb* /usr/local/bin/
COPY --from=gtirb-pprinter /usr/local/lib /usr/local/lib
COPY --from=gtirb-pprinter /usr/local/include /usr/local/include
# .git directory is needed to correctly generate version information
COPY .git/ /usr/local/src/ddisasm/.git
COPY doc/ /usr/local/src/ddisasm/doc/
COPY src/ /usr/local/src/ddisasm/src/
COPY CMakeLists.txt \
CMakeLists.googletest \
LICENSE.txt \
README.md \
version.txt \
/usr/local/src/ddisasm/
RUN cmake -DCMAKE_BUILD_TYPE=Release -DDDISASM_GENERATE_MANY=ON /usr/local/src/ddisasm -B/usr/local/src/ddisasm/build
RUN cmake --build /usr/local/src/ddisasm/build -j$(nproc) --target all install
# ------------------------------------------------------------------------------
# Final image
# ------------------------------------------------------------------------------
FROM ubuntu:20.04
COPY --from=ddisasm /lib/x86_64-linux-gnu/libboost_filesystem.so.1.71.0 /lib/x86_64-linux-gnu/libboost_filesystem.so.1.71.0
COPY --from=ddisasm /lib/x86_64-linux-gnu/libboost_program_options.so.1.71.0 /lib/x86_64-linux-gnu/libboost_program_options.so.1.71.0
COPY --from=ddisasm /lib/libcapstone.so.5 /lib/libcapstone.so.5
COPY --from=ddisasm /lib/x86_64-linux-gnu/libgomp.so* /lib/x86_64-linux-gnu/
COPY --from=ddisasm /usr/local/lib/libgtirb.so* /usr/local/lib/
COPY --from=ddisasm /usr/local/lib/libgtirb_layout.so* /usr/local/lib/
COPY --from=ddisasm /usr/local/lib/libgtirb_pprinter.so* /usr/local/lib/
COPY --from=ddisasm /lib/x86_64-linux-gnu/libprotobuf.so* /lib/x86_64-linux-gnu/
COPY --from=ddisasm /usr/local/bin/ddisasm /usr/local/bin/
COPY --from=ddisasm /usr/local/bin/gtirb* /usr/local/bin/
# gcc is needed to rebuild binaries with gtirb-pprinter
RUN apt-get update -y && apt-get install -y --no-install-recommends \
gcc \
libc6-dev
ENV LD_LIBRARY_PATH=/usr/local/lib
# `grep -v 'UNKNOWN'`: return a failure code if the version string contains 'UNKNOWN'
RUN gtirb-pprinter --version | grep -v 'UNKNOWN'
RUN ddisasm --version | grep -v 'UNKNOWN'