base image on release instead of git + doc + launch script

Summary: public Add instructions how to use the docker image, a script to automatically
build and run the docker container, and base the docker image on the latest
release of infer instead of git, which saves compiling clang.

Reviewed By: cristianoc

Differential Revision: D2564909

fb-gh-sync-id: 5c8ea96
master
Jules Villard 9 years ago committed by facebook-github-bot-7
parent 9b15656258
commit f2d80d1a40

@ -1,54 +1,59 @@
# Base image
FROM heikomaass/android-sdk
# Author
MAINTAINER doctorq <542113578@qq.com>
MAINTAINER Infer
# Add build-tools-22 to the Android SDK
RUN ["/opt/sdk-tools/android-accept-licenses.sh", "android update sdk --filter \"build-tools-22.0.1\" --no-ui --force -a"]
# Install tools
RUN apt-get update; \
apt-get upgrade; \
apt-get install -y \
# Debian config
RUN apt-get update && \
apt-get install -y --no-install-recommends \
build-essential \
curl \
git \
groff \
libgmp-dev \
libmpc-dev \
libmpfr-dev \
m4 \
ocaml \
python-software-properties \
rsync \
software-properties-common \
unzip \
zlib1g-dev
# Install a recent Gradle
RUN add-apt-repository ppa:cwchien/gradle
RUN apt-get update && \
apt-get install gradle-2.5
# Install OPAM
RUN add-apt-repository ppa:avsm/ppa
RUN apt-get update; \
apt-get install -y \
camlp4-extra \
ocaml \
ocaml-native-compilers \
opam
RUN opam init --yes --comp=4.01.0
RUN opam install -y extlib.1.5.4 atdgen.1.6.0 javalib.2.3.1 sawja.1.5.1
# Download Infer source code
RUN git clone https://github.com/facebook/infer.git
# Install Facebook Clang Plugins and clang
RUN cd infer; git pull; \
git submodule update --init; \
facebook-clang-plugins/clang/setup.sh
RUN cd infer; eval $(opam config env); \
git submodule update; \
./compile-fcp.sh
RUN curl -sL \
https://github.com/ocaml/opam/releases/download/1.2.2/opam-1.2.2-x86_64-Linux \
-o /usr/local/bin/opam && \
chmod 755 /usr/local/bin/opam
RUN opam init -y --comp=4.01.0 && \
opam install -y extlib.1.5.4 atdgen.1.6.0 javalib.2.3.1 sawja.1.5.1
# Download the latest Infer release
RUN INFER_VERSION=$(curl -s https://api.github.com/repos/facebook/infer/releases \
| grep -e '^[ ]\+"tag_name"' \
| head -1 \
| cut -d '"' -f 4); \
cd /opt && \
curl -sL \
https://github.com/facebook/infer/releases/download/${INFER_VERSION}/infer-linux64-${INFER_VERSION}.tar.xz | \
tar xJ && \
rm -f /infer && \
ln -s ${PWD}/infer-linux64-$INFER_VERSION /infer
# Compile Infer
RUN cd /infer && \
eval $(opam config env) && \
make -C infer clang java
# Install Infer
RUN cd infer; eval $(opam config env); \
make -C infer clang java
ENV INFER_HOME /infer/infer
ENV PATH ${INFER_HOME}/bin:${PATH}
# Install Gradle 2.5
RUN add-apt-repository ppa:cwchien/gradle
RUN apt-get update; apt-get install gradle-2.5

@ -0,0 +1,31 @@
# docker images for Infer
This directory contains a docker file to install Infer within a
[docker](https://www.docker.com/) container. This can be used to
quickly try Infer or to deploy Infer.
## 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 the latest
[released](https://github.com/facebook/infer/releases) version of
Infer. Simply type "./run.sh" to get a shell inside the docker
container. It will have built and installed Infer. You can then try
out Infer on the introductory examples:
```sh
# compiles Infer; this takes a few minutes
./run.sh
# you should now be inside the docker container with a shell prompt, e.g.
# "root@5c3b9af90d59:/# "
cd /infer/examples/android_hello/
infer -- gradle build
```

@ -0,0 +1,51 @@
#!/bin/sh
# Copyright (c) 2015 - present Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the BSD style license found in the
# LICENSE file in the root directory of this source tree. An additional grant
# of patent rights can be found in the PATENTS file in the same directory.
EXEC_NAME="$0"
show_usage() {
echo "Usage: $EXEC_NAME [-h]"
echo ""
echo "Build and run the docker image. See infer/docker/README.md for more"
echo "information."
echo ""
echo "Options:"
echo " -h, --help Show this message and exit"
}
while [ -n "$1" ]; do
arg="$1"
case $arg in
"-h" | "--help" )
show_usage;
exit 0;
;;
*)
echo "unknown argument $1"
show_usage;
exit 1;
;;
esac
done
if ! docker --version > /dev/null; then
echo "docker install not working"
exit 1
fi
if [ ! -f Dockerfile ]; then
echo "Dockerfile not found. Are you in the right directory?"
echo "Please see infer/docker/README.md for more information."
exit 1
fi
NAME="infer"
docker build -t $NAME . && \
docker run -it $NAME /bin/bash
Loading…
Cancel
Save