forked from radareorg/radare2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
100 lines (91 loc) · 2.32 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
# r2docker
# ========
#
# Requires 1GB of free disk space
#
# Build docker image with:
# $ docker build -t r2docker:latest .
#
# Run the docker image:
# $ docker images
# $ export DOCKER_IMAGE_ID=$(docker images --format '{{.ID}}' -f 'label=r2docker')
# $ docker run -ti --cap-drop=ALL r2docker:latest
#
# Once you quit the bash session get the container id with:
# $ docker ps -a | grep bash
#
# To get into that shell again just type:
# $ docker start -ai <containedid>
#
# To share those images:
# $ docker export <containerid> | xz > container.xz
# $ xz -d < container.xz | docker import -
#
#
# If you willing to debug a program within Docker, you should run it with CAP_SYS_PTRACE:
#
# $ docker run -it --cap-drop=ALL --cap-add=SYS_PTRACE r2docker:latest
# $ r2 -d /bin/true
#
# Using debian 9 as base image.
FROM debian:9
# Label base
LABEL r2docker latest
# Radare version
ENV R2_VERSION master
# R2pipe python version
ENV R2_PIPE_PY_VERSION 0.8.9
# R2pipe node version
ENV R2_PIPE_NPM_VERSION 2.3.2
# Build radare2 in a volume to minimize space used by build
VOLUME ["/mnt"]
# Install all build dependencies
# Install bindings
# Build and install radare2 on master branch
# Remove all build dependencies
# Cleanup
RUN DEBIAN_FRONTEND=noninteractive dpkg --add-architecture i386 && \
apt-get update && \
apt-get install -y \
curl \
gcc \
git \
bison \
pkg-config \
make \
glib-2.0 \
libc6:i386 \
libncurses5:i386 \
libstdc++6:i386 \
gnupg2 \
sudo && \
curl -sL https://deb.nodesource.com/setup_8.x | bash - && \
apt-get install -y nodejs python-pip && \
pip install r2pipe=="$R2_PIPE_PY_VERSION" && \
npm install --unsafe-perm -g "r2pipe@$R2_PIPE_NPM_VERSION" && \
cd /mnt && \
git clone -b "$R2_VERSION" --depth 1 https://github.com/radare/radare2.git && \
cd radare2 && \
./sys/install.sh && \
make install && \
apt-get install -y xz-utils && \
apt-get remove --purge -y \
bison \
python-pip \
glib-2.0 && \
apt-get autoremove --purge -y && \
apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# Create non-root user
RUN useradd -m r2 && \
adduser r2 sudo && \
echo "r2:r2" | chpasswd
# Initilise base user
USER r2
WORKDIR /home/r2
ENV HOME /home/r2
# Setup r2pm
RUN r2pm init && \
r2pm update && \
chown -R r2:r2 /home/r2/.config
# Base command for container
CMD ["/bin/bash"]