Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Docker #117

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
docker/
Dockerfile
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,14 @@ cd test
make check
```

## Docker

```sh
docker build --rm -t redex .

docker run -it -v $ANDROID_SDK:/opt/android-sdk-linux -v $(pwd):/redex redex redex path/to/your.apk -o path/to/output.apk
```

## Usage

To use ReDex, first build your app and find the APK for it. Then run:
Expand Down
38 changes: 38 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Usage: docker run -it -v $ANDROID_SDK:/opt/android-sdk-linux -v $(pwd):/redex redex redex path/to/your.apk -o path/to/output.apk
# Build: docker build --rm -t redex -f docker/Dockerfile .
FROM ubuntu:14.04

ADD . /redex

WORKDIR /redex
ENV LD_LIBRARY_PATH /usr/local/lib
ENV ANDROID_HOME /opt/android-sdk-linux
ENV ANDROID_SDK $ANDROID_HOME

RUN apt-get update && apt-get install -y git \
g++ \
automake \
autoconf \
autoconf-archive \
libtool \
libboost-all-dev \
libevent-dev \
libdouble-conversion-dev \
libgoogle-glog-dev \
libgflags-dev \
liblz4-dev \
liblzma-dev \
libsnappy-dev \
make \
zlib1g-dev \
binutils-dev \
libjemalloc-dev \
libssl-dev \
python3 \
libiberty-dev && \
git submodule update --init && \
autoreconf -ivf && ./configure && make && make install && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

CMD ["redex"]
24 changes: 24 additions & 0 deletions docker/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# docker images for redex

This directory, `docker/` inside the redex repo,
contains a docker file to install redex within a
[docker](https://www.docker.com/) container. This can be used to
quickly try redex or to deploy redex.


## Pre-requisites

To use this docker image, you will need a working docker
installation. See the instructions for
[Linux](http://docs.docker.com/linux/step_one/) or
[MacOSX](http://docs.docker.com/mac/step_one/) as appropriate.


## How to use

This docker file will use current commit of redex.

```sh
docker build --rm -t redex:android -f docker/android/Dockerfile .
./docker/redex path/to/your.apk -o path/to/output.apk
```
34 changes: 34 additions & 0 deletions docker/android/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
FROM yongjhih/android:23

ADD . /redex

WORKDIR /redex
ENV LD_LIBRARY_PATH /usr/local/lib

RUN apt-get update && apt-get install -y git \
g++ \
automake \
autoconf \
autoconf-archive \
libtool \
libboost-all-dev \
libevent-dev \
libdouble-conversion-dev \
libgoogle-glog-dev \
libgflags-dev \
liblz4-dev \
liblzma-dev \
libsnappy-dev \
make \
zlib1g-dev \
binutils-dev \
libjemalloc-dev \
libssl-dev \
python3 \
libiberty-dev && \
git submodule update --init && \
autoreconf -ivf && ./configure && make && make install && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

CMD ["redex"]
42 changes: 42 additions & 0 deletions docker/redex
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/usr/bin/env bash
#
# Run docker-redex in a container
#
# This script will attempt to mirror the host paths by using volumes for the
# following paths:
# * $(pwd)
# * $HOME if it's set
#

set -e

IMAGE="redex:android"

# Setup options for connecting to docker host
if [ -z "$DOCKER_HOST" ]; then
DOCKER_HOST="/var/run/docker.sock"
fi
if [ -S "$DOCKER_HOST" ]; then
DOCKER_ADDR="-v $DOCKER_HOST:$DOCKER_HOST -e DOCKER_HOST"
else
DOCKER_ADDR="-e DOCKER_HOST -e DOCKER_TLS_VERIFY -e DOCKER_CERT_PATH"
fi


# Setup volume mounts for compose config and context
if [ "$(pwd)" != '/' ]; then
VOLUMES="-v $(pwd):$(pwd)"
fi
if [ -n "$HOME" ]; then
VOLUMES="$VOLUMES -v $HOME:$HOME -v $HOME:/root" # mount $HOME in /root to share docker.config
fi

# Only allocate tty if we detect one
if [ -t 1 ]; then
DOCKER_RUN_OPTIONS="-t"
fi
if [ -t 0 ]; then
DOCKER_RUN_OPTIONS="$DOCKER_RUN_OPTIONS -i"
fi

exec docker run --rm $DOCKER_RUN_OPTIONS $DOCKER_ADDR $VOLUMES -w "$(pwd)" $IMAGE redex "$@"