-
Notifications
You must be signed in to change notification settings - Fork 5
/
Dockerfile
49 lines (39 loc) · 1.54 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
##################################
# First, build the builder image #
##################################
FROM rust:1.45-slim as build
# First, install some build dependencies
RUN apt-get update && apt-get install -y build-essential clang llvm-dev python unzip wget
# Install the unicorn emulator library
WORKDIR /usr/src/unicorn
RUN wget https://github.com/unicorn-engine/unicorn/archive/1.0.1.zip -O unicorn_src.zip && unzip unicorn_src.zip
WORKDIR /usr/src/unicorn/unicorn-1.0.1
RUN make && make install && rm -rf /usr/src/unicorn
# Install the capstone disassembly library
WORKDIR /usr/src/capstone
RUN wget https://github.com/aquynh/capstone/archive/4.0.2.tar.gz -O- | tar xvz
WORKDIR /usr/src/capstone/capstone-4.0.2
RUN make && make install && rm -rf /usr/src/capstone
# Then, build berbalang
WORKDIR /usr/src/berbalang
COPY ./Cargo.toml .
COPY ./Cargo.lock .
COPY ./src ./src
RUN cargo build --release
RUN find target/release -type f -maxdepth 2 -executable -exec strip -s {} +
##################################
# Now build the deployment image #
##################################
FROM debian:buster-slim
# Add the python dependencies
RUN apt-get update && apt-get install -y python3 python3-pip && pip3 install pytz toml
# Copy the unicorn library, dynamically linked
COPY --from=build /usr/lib/libunicorn* /usr/lib/
# Copy the berbalang binary
COPY --from=build /usr/src/berbalang/target/release/berbalang /root/berbalang
# Now switch to the running directory
WORKDIR /root/
COPY ./start.sh .
COPY ./trials.sh .
COPY ./analysis ./analysis
CMD ["bash"]