revamped Dockerfile to produce a smaller image (half the previous size)
Change-Id: Ia8d7cfc3ecbe167addc7bf7102a254900fbe8c2c
diff --git a/tools/build/docker/Dockerfile b/tools/build/docker/Dockerfile
index 08e2688..214c11c 100644
--- a/tools/build/docker/Dockerfile
+++ b/tools/build/docker/Dockerfile
@@ -1,15 +1,12 @@
FROM debian
MAINTAINER Ali Al-Shabibi <ali@onlab.us>
-# Install required software
+# 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 && \
- apt-get update && \
- apt-get install -y oracle-java8-installer oracle-java8-set-default maven git curl && \
- apt-get clean && apt-get purge
+ apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys EEA14886
# Set the environment variables
ENV HOME /root
@@ -21,24 +18,28 @@
ENV BUILD_NUMBER docker
ENV PATH $PATH:$KARAF_ROOT/bin
-
-# Change to /src directory
+#Download and Build ONOS
WORKDIR /src
-
-# Download ONOS
-RUN git clone https://github.com/opennetworkinglab/onos.git
-
-#Install ONOS
-WORKDIR /src/onos
-RUN mkdir -p /root/Downloads && \
+RUN apt-get update && apt-get install -y maven git curl oracle-java8-installer oracle-java8-set-default && \
+ git clone https://github.com/opennetworkinglab/onos.git && cd onos && \
+ mkdir -p /root/Downloads && \
mvn clean install && \
- ./tools/build/onos-package
+ tools/build/onos-package && \
+ rm -rf /root/.m2 && cd .. && \
+ rm -rf onos && \
+ apt-get remove --purge -y `apt-mark showauto` && \
+ apt-get install oracle-java8-set-default -y && \
+ apt-get clean && apt-get purge -y && apt-get autoremove -y && \
+ rm -rf /var/lib/apt/lists/* && \
+ rm -rf /var/cache/oracle-jdk8-installer && \
+ rm -rf /root/Downloads
# Change to /root directory
WORKDIR /root
+#Install ONOS
RUN mkdir onos && \
- cp /tmp/onos-*.docker.tar.gz . && \
+ mv /tmp/onos-*.docker.tar.gz . && \
tar -xf onos-*.docker.tar.gz -C onos --strip-components=1 && \
rm -rf onos-*.docker.tar.gz