radare2/Dockerfile

110 lines
2.6 KiB
Docker
Raw Normal View History

# r2docker
# ========
2014-12-10 01:06:21 +00:00
#
# Requires 1GB of free disk space
2014-12-10 01:06:21 +00:00
#
# Build docker image with:
2017-03-24 21:23:03 +00:00
# $ docker build -t r2docker:latest .
2014-12-10 01:06:21 +00:00
#
# Run the docker image:
# $ docker images
2017-03-24 21:23:03 +00:00
# $ export DOCKER_IMAGE_ID=$(docker images --format '{{.ID}}' -f 'label=r2docker')
# $ docker run -ti --cap-drop=ALL r2docker:latest
2014-12-10 01:06:21 +00:00
#
# Once you quit the bash session get the container id with:
# $ docker ps -a | grep bash
#
# To get into that shell again just type:
2014-12-10 12:39:41 +00:00
# $ docker start -ai <containedid>
2014-12-10 01:06:21 +00:00
#
# To share those images:
# $ docker export <containerid> | xz > container.xz
# $ xz -d < container.xz | docker import -
#
#
2017-03-24 21:23:03 +00:00
# If you willing to debug a program within Docker, you should run it with CAP_SYS_PTRACE:
#
2017-03-24 21:23:03 +00:00
# $ docker run -it --cap-drop=ALL --cap-add=SYS_PTRACE r2docker:latest
# $ r2 -d /bin/true
#
2014-12-10 01:06:21 +00:00
# Using debian 9 as base image.
FROM debian:9
2014-12-10 01:06:21 +00:00
2017-03-24 21:23:03 +00:00
# Label base
LABEL r2docker latest
2014-12-10 01:06:21 +00:00
2017-03-24 21:23:03 +00:00
# Radare version
ARG R2_VERSION=master
2017-03-24 21:23:03 +00:00
# R2pipe python version
ARG R2_PIPE_PY_VERSION=0.8.9
2017-03-24 21:23:03 +00:00
# R2pipe node version
ARG R2_PIPE_NPM_VERSION=2.3.2
ENV R2_VERSION ${R2_VERSION}
ENV R2_PIPE_PY_VERSION ${R2_PIPE_PY_VERSION}
ENV R2_PIPE_NPM_VERSION ${R2_PIPE_NPM_VERSION}
RUN echo -e "Building versions:\n\
R2_VERSION=$R2_VERSION\n\
R2_PIPE_PY_VERSION=${R2_PIPE_PY_VERSION}\n\
R2_PIPE_NPM_VERSION=${R2_PIPE_NPM_VERSION}"
2014-12-10 01:06:21 +00:00
2017-03-24 21:23:03 +00:00
# Build radare2 in a volume to minimize space used by build
VOLUME ["/mnt"]
2017-03-24 21:23:03 +00:00
# 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 \
2017-03-24 21:23:03 +00:00
sudo && \
curl -sL https://deb.nodesource.com/setup_8.x | bash - && \
2017-03-24 21:23:03 +00:00
apt-get install -y nodejs python-pip && \
pip install r2pipe=="$R2_PIPE_PY_VERSION" && \
npm install --unsafe-perm -g "r2pipe@$R2_PIPE_NPM_VERSION" && \
2017-03-24 21:23:03 +00:00
cd /mnt && \
2018-10-06 02:32:03 +00:00
git clone -b "$R2_VERSION" -q --depth 1 https://github.com/radare/radare2.git && \
2017-03-24 21:23:03 +00:00
cd radare2 && \
./sys/install.sh && \
make install && \
apt-get install -y xz-utils && \
2017-03-24 21:23:03 +00:00
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/*
2017-03-24 21:23:03 +00:00
# Create non-root user
RUN useradd -m r2 && \
adduser r2 sudo && \
echo "r2:r2" | chpasswd
2014-12-10 01:06:21 +00:00
2017-03-24 21:23:03 +00:00
# Initilise base user
2017-03-10 09:24:43 +00:00
USER r2
WORKDIR /home/r2
2017-03-24 21:23:03 +00:00
ENV HOME /home/r2
# Setup r2pm
RUN r2pm init && \
r2pm update && \
chown -R r2:r2 /home/r2/.config
2017-03-24 21:23:03 +00:00
# Base command for container
CMD ["/bin/bash"]