Docker build using bazel
Change-Id: I0f2377b71b73c8ec19e15734c5ddb7810ab6ab39
diff --git a/.dockerignore b/.dockerignore
index 24b8dc4..05151e2 100644
--- a/.dockerignore
+++ b/.dockerignore
@@ -14,3 +14,11 @@
web/gui/src/test/_karma/node_modules
web/gui/src/main/webapp/node_modules
+bazel-bin
+bazel-genfiles
+bazel-out
+bazel-testlogs
+bazel-onos-next
+bazel
+
+
diff --git a/Dockerfile b/Dockerfile
index a4709b8..ecd46e8 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -16,14 +16,18 @@
# FIXME - dependence on ONOS_ROOT and git at build time is a hack to work around
# build problems
WORKDIR /src/onos
-RUN apt-get update && apt-get install -y zip python git bzip2 && \
+RUN apt-get update && apt-get install -y zip python git bzip2 build-essential && \
+ curl -L -o bazel.sh https://github.com/bazelbuild/bazel/releases/download/0.15.2/bazel-0.15.2-installer-linux-x86_64.sh && \
+ chmod +x bazel.sh && \
+ ./bazel.sh --user && \
export ONOS_ROOT=/src/onos && \
- tools/build/onos-buck build onos && \
+ ln -s /usr/lib/jvm/java-8-oracle/bin/jar /etc/alternatives/jar && \
+ ln -s /etc/alternatives/jar /usr/bin/jar && \
+ ~/bin/bazel build onos --verbose_failures --jobs 4 && \
mkdir -p /src/tar && \
cd /src/tar && \
- tar -xf /src/onos/buck-out/gen/tools/package/onos-package/onos.tar.gz --strip-components=1 && \
- rm -rf /src/onos/buck-out .git
-
+ tar -xf /src/onos/bazel-bin/onos.tar.gz --strip-components=1 && \
+ rm -rf /src/onos/bazel-* .git
# Second stage is the runtime environment
FROM anapsix/alpine-java:8_server-jre