Dockerfile to build image from prebuilt tar file

Change-Id: If386255286fea648d112a83a4503701523a78267
diff --git a/.dockerignore b/.dockerignore
index f78caff..10473cf 100644
--- a/.dockerignore
+++ b/.dockerignore
@@ -7,6 +7,7 @@
 
 .buckd
 buck-out
+!buck-out/gen/tools/package/onos-package/onos.tar.gz
 bucklets/plugins
 .git
 bin
diff --git a/Dockerfile.prebuilt b/Dockerfile.prebuilt
new file mode 100644
index 0000000..204a880
--- /dev/null
+++ b/Dockerfile.prebuilt
@@ -0,0 +1,38 @@
+# Builds an ONOS docker image from a prebuilt tar.gz file.
+# tar.gz must be located in your onos directory at
+# buck-out/gen/tools/package/onos-package/onos.tar.gz
+
+FROM anapsix/alpine-java:8_server-jre
+
+# Change to /root directory
+RUN apk update && \
+        apk add curl && \
+        apk --update add tar && \
+        mkdir -p /root/onos
+WORKDIR /root/onos
+
+# Install ONOS
+COPY buck-out/gen/tools/package/onos-package/onos.tar.gz .
+RUN tar -xzvf onos.tar.gz --strip-components=1
+
+# Configure ONOS to log to stdout
+RUN sed -ibak '/log4j.rootLogger=/s/$/, stdout/' $(ls -d apache-karaf-*)/etc/org.ops4j.pax.logging.cfg
+
+LABEL org.label-schema.name="ONOS" \
+      org.label-schema.description="SDN Controller" \
+      org.label-schema.usage="http://wiki.onosproject.org" \
+      org.label-schema.url="http://onosproject.org" \
+      org.label-scheme.vendor="Open Networking Foundation" \
+      org.label-schema.schema-version="1.0"
+
+# Ports
+# 6653 - OpenFlow
+# 6640 - OVSDB
+# 8181 - GUI
+# 8101 - ONOS CLI
+# 9876 - ONOS intra-cluster communication
+EXPOSE 6653 6640 8181 8101 9876
+
+# Get ready to run command
+ENTRYPOINT ["./bin/onos-service"]
+CMD ["server"]