For developing Heron, you will need to compile it for the environment that you want to use it in. If you'd like to use Docker to create that build environment, Heron provides a convenient script to make that process easier.
Currently, only Ubuntu 14.04, Ubuntu 15.10, and CentOS 7 are supported, but if you need another platform there are instructions for adding new ones below.
If you are running Docker in a virtual machine (VM), it is recommended that you adjust your settings to help speed up the build. To do this, open VirtualBox and go to the container in which Docker is running (usually “default” or whatever name you used to create the VM), click on the VM, and then click on Settings.
Note: You will need to stop the VM before modifying these settings.
Heron provides a build-arfifacts.sh
script for Docker located in the docker
folder. To run that script:
$ cd /path/to/heron/repo $ docker/build-artifacts.sh
Running the script by itself will display usage information:
Usage: docker/build-artifacts.sh <platform> <version_string> [source-tarball] <output-directory> Platforms Supported: darwin, ubuntu14.04, ubuntu15.10, centos7 Example: ./build-artifacts.sh ubuntu14.04 0.12.0 . NOTE: If running on OSX, the output directory will need to be under /Users so virtualbox has access to.
The following arguments are required:
platform
--- Currently, this can be one of: ubuntu14.04
, centos7
. You can add other platforms using the instructions below.version-string
--- The Heron release for which you'd like to build artifacts.output-directory
--- The directory in which you'd like the release to be built.Here's an example usage:
$ docker/scripts/build-artifacts.sh ubuntu14.04 0.12.0 ~/heron-release
This will build a Docker container specific to Ubuntu 14.04, create a source tarball of the Heron repository, run a full release build of Heron, and then copy the artifacts into the ~/heron-release
directory.
Optionally, you can also include a tarball of the Heron source if you have one. By default, the script will create a tarball of the current source in the Heron repo and use that to build the artifacts.
Note: If you are running on Mac OS X, Docker must be run inside a VM. Therefore, you must make sure that both the source tarball and destination directory are somewhere under your home directory. For example, you cannot output the Heron artifacts to /tmp
because /tmp
refers to the directory inside the VM, not on the host machine. Your home directory, however, is automatically linked in to the VM and can be accessed normally.
After the build has completed, you can go to your output directory and see all of the generated artifacts:
$ ls ~/heron-release heron-0.12.0-ubuntu14.04.tar heron-0.12.0-ubuntu14.04.tar.gz heron-core-0.12.0-ubuntu14.04.tar.gz heron-install-0.12.0-ubuntu14.04.sh heron-layer-0.12.0-ubuntu14.04.tar heron-tools-0.12.0-ubuntu14.04.tar.gz
You‘ll notice that there are multiple Dockerfiles in the docker
directory of Heron’s source code, one for each of the currently supported platforms.
To add support for a new platform, add a new Dockerfile
to that directory and append the name of the platform to the name of the file. If you‘d like to add support for Debian 8, for example, add a file named Dockerfile.debian8
. Once you’ve done that, follow the instructions in the Docker documentation.
You should make sure that your Dockerfile
specifies at least all of the following:
FROM
statement.Here's an example:
FROM centos:centos7
TARGET_PLATFORM
environment variable using the ENV
instruction.Here's an example:
ENV TARGET_PLATFORM centos
RUN
instruction.Here's an example:
RUN apt-get update && apt-get -y install \ automake \ build-essential \ cmake \ curl \ libssl-dev \ git \ libtool \ libunwind8 \ libunwind-setjmp0-dev \ python \ python2.7-dev \ python-software-properties \ software-properties-common \ python-setuptools \ unzip \ wget
JAVA_HOME
environment variableHere's an example:
RUN \ echo oracle-java8-installer shared/accepted-oracle-license-v1-1 select true | debconf-set-selections && \ add-apt-repository -y ppa:webupd8team/java && \ apt-get update && \ apt-get install -y oracle-java8-installer && \ rm -rf /var/lib/apt/lists/* && \ rm -rf /var/cache/oracle-jdk8-installer ENV JAVA_HOME /usr/lib/jvm/java-8-oracle
Here's an example:
RUN wget -O /tmp/bazel.sh https://github.com/bazelbuild/bazel/releases/download/0.23.2/bazel-0.23.2-installer-linux-x86_64.sh \ && chmod +x /tmp/bazel.sh \ && /tmp/bazel.sh
bazelrc
configuration file for Bazel and the compile.sh
script (from the docker
folder) that compiles HeronADD bazelrc /root/.bazelrc ADD compile.sh /compile.sh