diff --git a/docker/Dockerfile b/docker/Dockerfile index 0f5a6d110..2ff9d6bf2 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,25 +1,19 @@ # Base image -FROM heikomaass/android-sdk +FROM buildpack-deps:xenial-curl MAINTAINER Infer -# Add android-22 and build-tools-22 to the Android SDK -RUN ["/opt/sdk-tools/android-accept-licenses.sh", \ - "android update sdk --filter \"android-22\" --no-ui --force --all"] -RUN ["/opt/sdk-tools/android-accept-licenses.sh", \ - "android update sdk --filter \"build-tools-22.0.1\" --no-ui --force --all"] - # Debian config RUN apt-get update && \ apt-get install -y --no-install-recommends \ + aspcud \ autoconf \ - curl \ + automake \ gcc \ g++ \ git \ - groff \ + groff-base \ libc6-dev \ - libffi-dev \ libgmp-dev \ libmpc-dev \ libmpfr-dev \ @@ -27,25 +21,17 @@ RUN apt-get update && \ make \ ncurses-dev \ ocaml \ + opam \ + openjdk-8-jdk-headless \ pkg-config \ - python-software-properties \ + python2.7 \ rsync \ - software-properties-common \ unzip \ - zlib1g-dev - -# Install OPAM -RUN VERSION=1.2.2; \ - curl -sL \ - https://github.com/ocaml/opam/releases/download/$VERSION/opam-$VERSION-x86_64-Linux \ - -o /usr/local/bin/opam && \ - chmod 755 /usr/local/bin/opam && \ - ((/usr/local/bin/opam --version | grep -q $VERSION) || \ - (echo "failed to download opam from GitHub."; exit 1)) -RUN opam init -y --comp=4.02.3 + zlib1g-dev && \ + rm -rf /var/lib/apt/lists/* # Download the latest Infer release -RUN INFER_VERSION=v0.10.0; \ +RUN INFER_VERSION=v0.11.0; \ cd /opt && \ curl -sL \ https://github.com/facebook/infer/releases/download/${INFER_VERSION}/infer-linux64-${INFER_VERSION}.tar.xz | \ @@ -54,9 +40,30 @@ RUN INFER_VERSION=v0.10.0; \ ln -s ${PWD}/infer-linux64-$INFER_VERSION /infer # Compile Infer -RUN cd /infer && \ - ./build-infer.sh +RUN OCAML_VERSION=4.04.0; \ + opam init --compiler=$OCAML_VERSION -j $(getconf _NPROCESSORS_ONLN || echo 1) --yes && \ + cd /infer && \ + ./build-infer.sh --opam-switch $OCAML_VERSION && \ + rm -rf /root/.opam # Install Infer ENV INFER_HOME /infer/infer ENV PATH ${INFER_HOME}/bin:${PATH} + +# Install dependencies for Android sample +RUN apt-get update && \ + apt-get install -y --no-install-recommends \ + libc6-dev \ + libc6-i386 \ + lib32z1 \ + lib32stdc++6 && \ + rm -rf /var/lib/apt/lists/* + +ENV ANDROID_HOME /opt/android-sdk-linux +WORKDIR $ANDROID_HOME +RUN curl -o sdk-tools-linux.zip \ + https://dl.google.com/android/repository/sdk-tools-linux-3859397.zip && \ + unzip sdk-tools-linux.zip && \ + rm sdk-tools-linux.zip +ENV PATH ${ANDROID_HOME}/tools/bin:${PATH} +RUN echo "sdk.dir=${ANDROID_HOME}" > /infer/examples/android_hello/local.properties diff --git a/docker/README.md b/docker/README.md index 0bb1e9148..2100e5d4c 100644 --- a/docker/README.md +++ b/docker/README.md @@ -29,6 +29,7 @@ Infer. ./run.sh # you should now be inside the docker container with a shell prompt, e.g. # "root@5c3b9af90d59:/infer/examples# " +sdkmanager --licenses cd android_hello/ infer -- ./gradlew build ``` diff --git a/docker/run.sh b/docker/run.sh index 36aeb91c7..15e907637 100755 --- a/docker/run.sh +++ b/docker/run.sh @@ -48,4 +48,8 @@ fi NAME="infer" docker build -t $NAME . && \ +echo "*************************************************************" && \ +echo "To build the Android example, you must accept the Android SDK" && \ +echo "licenses by running 'sdkmanager --licenses' first." && \ +echo "*************************************************************" && \ docker run -it $NAME /bin/bash -c 'cd /infer/examples/; exec /bin/bash'