Skip to content

Commit

Permalink
Add development Dockerfile
Browse files Browse the repository at this point in the history
* Development dockerfile builds from the current source directory
* Add instructions to build and use docker container
  • Loading branch information
HugoKlepsch authored and Hugo Klepsch committed Dec 20, 2017
1 parent 4af29cf commit 8c4497c
Show file tree
Hide file tree
Showing 3 changed files with 83 additions and 7 deletions.
8 changes: 3 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,8 @@ RUN git clone --recursive https://github.com/avast-tl/retdec && \
cd retdec && \
mkdir build && \
cd build && \
cmake .. -DCMAKE_INSTALL_PREFIX=/home/retdec/retdec-install && \
make && \
cmake .. -DCMAKE_INSTALL_PREFIX=/home/retdec/install && \
make -j$(nproc) && \
make install

ENV PATH /home/retdec/retdec-install/bin:$PATH

CMD ["/bin/bash"]
ENV PATH /home/retdec/install/bin:$PATH
23 changes: 23 additions & 0 deletions Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
FROM ubuntu:bionic

RUN useradd -m retdec
WORKDIR /home/retdec
ENV HOME /home/retdec

RUN apt-get -y update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y build-essential git bc graphviz upx cmake python zlib1g-dev flex bison libtinfo-dev autoconf pkg-config m4 libtool wget

COPY . retdec
RUN chown -R retdec:retdec retdec

USER retdec

RUN cd retdec && \
ls -alh && \
mkdir build && \
cd build && \
cmake .. -DCMAKE_INSTALL_PREFIX=/home/retdec/install && \
make -j$(nproc) && \
make install

ENV PATH /home/retdec/install/bin:$PATH
59 changes: 57 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,64 @@ Currently, we support only Windows (7 or later), Linux and unofficially macOS.
## Build and Installation
### Build in Docker
#### Build image
Building in Docker doesn't require installation of required libraries locally.
This is a good option for trying out retdec without setting up the whole build toolchain.

To build the retdec docker image, run

```
docker build -t retdec .
```
This builds the container from the master branch of this repository.
To build the container using the local copy of the repository, fully clone the repository:
```
git submodule update --init --recursive
```
Then build the container using the development Dockerfile, `Dockerfile.dev`:
```
docker build -t retdec:dev . -f Dockerfile.dev
```
#### Run container
To decompile a binary, create a container to upload the binary to:
```
docker create --name retdec retdec
```
Upload the binary:
```
docker cp <file> retdec:/destination/path/of/binary
```
Run the decompiler:
```
docker run retdec decompile.sh /destination/path/of/binary
```
Copy output back to host:
```
docker cp retdec:/destination/path/of/binary.c /path/to/save/file
```
### Build and install locally
This section describes a manual build and installation of RetDec.
### Requirements
#### Requirements
#### Linux
Expand Down Expand Up @@ -140,7 +195,7 @@ sudo dnf install git cmake make gcc gcc-c++ perl python3 bash zlib-devel flex bi
* [wget](https://www.gnu.org/software/wget/)
* [Python](https://www.python.org/) (version >= 3.4, macOS has 2.7)

### Process
#### Process

**Warning: Currently, RetDec has to be installed into a clean, dedicated directory. Do NOT install it into `/usr`, `/usr/local`, etc. because our build system is not yet ready for system-wide installations. So, when running `cmake`, always set `-DCMAKE_INSTALL_PREFIX=<path>` to a directory that will be used just by RetDec. For more details, see [#12](https://github.com/avast-tl/retdec/issues/12).**

Expand Down

0 comments on commit 8c4497c

Please sign in to comment.