Dockerfiles for building and pushing CORD ONOS apps
Change-Id: I8bcb39f6db6d1075a404ea869b7b0cf0af4f40c3
diff --git a/containers/cord-apps/Dockerfile b/containers/cord-apps/Dockerfile
new file mode 100644
index 0000000..0bd5550
--- /dev/null
+++ b/containers/cord-apps/Dockerfile
@@ -0,0 +1,26 @@
+FROM debian:jessie
+MAINTAINER Andy Bavier <andy@onlab.us>
+
+# Add Java 8 repository
+ENV DEBIAN_FRONTEND noninteractive
+RUN echo debconf shared/accepted-oracle-license-v1-1 select true | debconf-set-selections && \
+ echo "deb http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main" | tee /etc/apt/sources.list.d/webupd8team-java.list && \
+ echo "deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main" | tee -a /etc/apt/sources.list.d/webupd8team-java.list && \
+ apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys EEA14886
+
+# Set the environment variables
+ENV HOME /root
+ENV JAVA_HOME /usr/lib/jvm/java-8-oracle
+ENV ONOS_ROOT /src/onos
+ENV KARAF_VERSION 3.0.5
+ENV KARAF_ROOT /root/onos/apache-karaf-3.0.5
+ENV KARAF_LOG /root/onos/apache-karaf-3.0.5/data/log/karaf.log
+ENV BUILD_NUMBER docker
+ENV PATH $PATH:$KARAF_ROOT/bin
+
+#Download build environment for ONOS
+WORKDIR /src
+RUN apt-get update && apt-get install -y python maven git curl oracle-java8-installer oracle-java8-set-default && \
+ git clone https://github.com/opennetworkinglab/onos.git && cd onos
+
+RUN echo ". /src/onos/tools/dev/bash_profile" >> /root/.bashrc
diff --git a/containers/cord-apps/Dockerfile.config b/containers/cord-apps/Dockerfile.config
new file mode 100644
index 0000000..31dde4a
--- /dev/null
+++ b/containers/cord-apps/Dockerfile.config
@@ -0,0 +1,8 @@
+FROM xosproject/cord-app-build
+MAINTAINER Andy Bavier <andy@onlab.us>
+
+WORKDIR /src
+RUN git clone https://gerrit.opencord.org/p/config.git && cd config && \
+ mvn clean install
+
+CMD bash -c "source /root/.bashrc; onos-app onos-cord-1 install /src/config/target/cord-config-1.0-SNAPSHOT.oar && onos-app onos-cord-1 activate org.opencord.config"
\ No newline at end of file
diff --git a/containers/cord-apps/Dockerfile.vtn b/containers/cord-apps/Dockerfile.vtn
new file mode 100644
index 0000000..2091da6
--- /dev/null
+++ b/containers/cord-apps/Dockerfile.vtn
@@ -0,0 +1,8 @@
+FROM xosproject/cord-app-build
+MAINTAINER Andy Bavier <andy@onlab.us>
+
+WORKDIR /src
+RUN git clone https://gerrit.opencord.org/p/vtn.git && cd vtn && \
+ mvn clean install
+
+CMD bash -c "source /root/.bashrc; onos-app onos-cord-1 install /src/vtn/target/vtn-1.0-SNAPSHOT.oar && onos-app onos-cord-1 activate org.opencord.vtn"
diff --git a/containers/cord-apps/Makefile b/containers/cord-apps/Makefile
new file mode 100644
index 0000000..191e249
--- /dev/null
+++ b/containers/cord-apps/Makefile
@@ -0,0 +1,13 @@
+IMAGE_NAME:=xosproject/cord-app-build
+CONFIG_IMAGE_NAME:=xosproject/cord-app-config
+VTN_IMAGE_NAME:=xosproject/cord-app-vtn
+NO_DOCKER_CACHE?=false
+
+.PHONY: build
+build: ; sudo docker build --no-cache=${NO_DOCKER_CACHE} --rm -t ${IMAGE_NAME} .
+
+.PHONY: config
+config: ; sudo docker build --rm -t ${CONFIG_IMAGE_NAME} -f Dockerfile.config .
+
+.PHONY: vtn
+vtn: ; sudo docker build --rm -t ${VTN_IMAGE_NAME} -f Dockerfile.vtn .