blob: 82085e7034ba6180bc60c43ce21cf69c7f618ed3 [file] [log] [blame]
Jonathan Hart15a71d82017-07-20 16:14:21 -07001# First stage is the build environment
2FROM sgrio/java-oracle:jdk_8 as builder
3MAINTAINER Jonathan Hart <jono@opennetworking.org>
alshabib187f1722015-06-23 16:15:50 -07004
5# Set the environment variables
6ENV HOME /root
alshabib187f1722015-06-23 16:15:50 -07007ENV BUILD_NUMBER docker
Ray Milkey8c05c9b2017-03-15 15:47:57 -07008ENV JAVA_TOOL_OPTIONS=-Dfile.encoding=UTF8
Jonathan Hart809edee2016-12-15 18:33:05 -08009
Jonathan Hart77daee82017-01-16 14:29:20 -080010# Copy in the source
Jonathan Hart587dfac2017-01-09 14:42:50 -080011COPY . /src/onos/
alshabib187f1722015-06-23 16:15:50 -070012
Jonathan Hart77daee82017-01-16 14:29:20 -080013# Build ONOS
Jonathan Hart15a71d82017-07-20 16:14:21 -070014# We extract the tar in the build environment to avoid having to put the tar
15# in the runtime environment - this saves a lot of space
Ray Milkey9d81ea52017-07-20 10:36:51 -070016# FIXME - dependence on ONOS_ROOT and git at build time is a hack to work around
17# build problems
Jonathan Hart15a71d82017-07-20 16:14:21 -070018WORKDIR /src/onos
19RUN apt-get update && apt-get install -y zip python git && \
20 export ONOS_ROOT=/src/onos && \
Jonathan Harteb6950f2016-11-10 16:21:05 -080021 tools/build/onos-buck build onos && \
Jonathan Hart15a71d82017-07-20 16:14:21 -070022 mkdir -p /src/tar && \
23 cd /src/tar && \
24 tar -xf /src/onos/buck-out/gen/tools/package/onos-package/onos.tar.gz --strip-components=1 && \
25 rm -rf /src/onos/buck-out
26
27
28# Second stage is the runtime environment
29FROM anapsix/alpine-java:8_server-jre
alshabib187f1722015-06-23 16:15:50 -070030
31# Change to /root directory
Jonathan Hart15a71d82017-07-20 16:14:21 -070032RUN apk update && \
33 apk add curl && \
34 mkdir -p /root/onos
35WORKDIR /root/onos
alshabib187f1722015-06-23 16:15:50 -070036
Jonathan Hart77daee82017-01-16 14:29:20 -080037# Install ONOS
Jonathan Hart15a71d82017-07-20 16:14:21 -070038COPY --from=builder /src/tar/ .
alshabib187f1722015-06-23 16:15:50 -070039
Jonathan Hart15a71d82017-07-20 16:14:21 -070040LABEL org.label-schema.name="ONOS" \
41 org.label-schema.description="SDN Controller" \
42 org.label-schema.usage="http://wiki.onosproject.org" \
43 org.label-schema.url="http://onosproject.org" \
44 org.label-scheme.vendor="Open Networking Foundation" \
45 org.label-schema.schema-version="1.0"
alshabib187f1722015-06-23 16:15:50 -070046
47# Ports
Charles Chan45624b82015-08-24 00:29:20 +080048# 6653 - OpenFlow
Jonathan Hart77daee82017-01-16 14:29:20 -080049# 6640 - OVSDB
alshabib187f1722015-06-23 16:15:50 -070050# 8181 - GUI
51# 8101 - ONOS CLI
Jonathan Hart15a71d82017-07-20 16:14:21 -070052# 9876 - ONOS intra-cluster communication
Jonathan Hart77daee82017-01-16 14:29:20 -080053EXPOSE 6653 6640 8181 8101 9876
alshabib187f1722015-06-23 16:15:50 -070054
55# Get ready to run command
56WORKDIR /root/onos
David Bainbridgeff4fb042015-08-17 12:53:29 -070057ENTRYPOINT ["./bin/onos-service"]