Jonathan Hart | 15a71d8 | 2017-07-20 16:14:21 -0700 | [diff] [blame^] | 1 | # First stage is the build environment |
| 2 | FROM sgrio/java-oracle:jdk_8 as builder |
| 3 | MAINTAINER Jonathan Hart <jono@opennetworking.org> |
alshabib | 187f172 | 2015-06-23 16:15:50 -0700 | [diff] [blame] | 4 | |
| 5 | # Set the environment variables |
| 6 | ENV HOME /root |
alshabib | 187f172 | 2015-06-23 16:15:50 -0700 | [diff] [blame] | 7 | ENV BUILD_NUMBER docker |
Ray Milkey | 8c05c9b | 2017-03-15 15:47:57 -0700 | [diff] [blame] | 8 | ENV JAVA_TOOL_OPTIONS=-Dfile.encoding=UTF8 |
Jonathan Hart | 809edee | 2016-12-15 18:33:05 -0800 | [diff] [blame] | 9 | |
Jonathan Hart | 77daee8 | 2017-01-16 14:29:20 -0800 | [diff] [blame] | 10 | # Copy in the source |
Jonathan Hart | 587dfac | 2017-01-09 14:42:50 -0800 | [diff] [blame] | 11 | COPY . /src/onos/ |
alshabib | 187f172 | 2015-06-23 16:15:50 -0700 | [diff] [blame] | 12 | |
Jonathan Hart | 77daee8 | 2017-01-16 14:29:20 -0800 | [diff] [blame] | 13 | # Build ONOS |
Jonathan Hart | 15a71d8 | 2017-07-20 16:14:21 -0700 | [diff] [blame^] | 14 | # 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 Milkey | 9d81ea5 | 2017-07-20 10:36:51 -0700 | [diff] [blame] | 16 | # FIXME - dependence on ONOS_ROOT and git at build time is a hack to work around |
| 17 | # build problems |
Jonathan Hart | 15a71d8 | 2017-07-20 16:14:21 -0700 | [diff] [blame^] | 18 | WORKDIR /src/onos |
| 19 | RUN apt-get update && apt-get install -y zip python git && \ |
| 20 | export ONOS_ROOT=/src/onos && \ |
Jonathan Hart | eb6950f | 2016-11-10 16:21:05 -0800 | [diff] [blame] | 21 | tools/build/onos-buck build onos && \ |
Jonathan Hart | 15a71d8 | 2017-07-20 16:14:21 -0700 | [diff] [blame^] | 22 | 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 |
| 29 | FROM anapsix/alpine-java:8_server-jre |
alshabib | 187f172 | 2015-06-23 16:15:50 -0700 | [diff] [blame] | 30 | |
| 31 | # Change to /root directory |
Jonathan Hart | 15a71d8 | 2017-07-20 16:14:21 -0700 | [diff] [blame^] | 32 | RUN apk update && \ |
| 33 | apk add curl && \ |
| 34 | mkdir -p /root/onos |
| 35 | WORKDIR /root/onos |
alshabib | 187f172 | 2015-06-23 16:15:50 -0700 | [diff] [blame] | 36 | |
Jonathan Hart | 77daee8 | 2017-01-16 14:29:20 -0800 | [diff] [blame] | 37 | # Install ONOS |
Jonathan Hart | 15a71d8 | 2017-07-20 16:14:21 -0700 | [diff] [blame^] | 38 | COPY --from=builder /src/tar/ . |
alshabib | 187f172 | 2015-06-23 16:15:50 -0700 | [diff] [blame] | 39 | |
Jonathan Hart | 15a71d8 | 2017-07-20 16:14:21 -0700 | [diff] [blame^] | 40 | LABEL 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" |
alshabib | 187f172 | 2015-06-23 16:15:50 -0700 | [diff] [blame] | 46 | |
| 47 | # Ports |
Charles Chan | 45624b8 | 2015-08-24 00:29:20 +0800 | [diff] [blame] | 48 | # 6653 - OpenFlow |
Jonathan Hart | 77daee8 | 2017-01-16 14:29:20 -0800 | [diff] [blame] | 49 | # 6640 - OVSDB |
alshabib | 187f172 | 2015-06-23 16:15:50 -0700 | [diff] [blame] | 50 | # 8181 - GUI |
| 51 | # 8101 - ONOS CLI |
Jonathan Hart | 15a71d8 | 2017-07-20 16:14:21 -0700 | [diff] [blame^] | 52 | # 9876 - ONOS intra-cluster communication |
Jonathan Hart | 77daee8 | 2017-01-16 14:29:20 -0800 | [diff] [blame] | 53 | EXPOSE 6653 6640 8181 8101 9876 |
alshabib | 187f172 | 2015-06-23 16:15:50 -0700 | [diff] [blame] | 54 | |
| 55 | # Get ready to run command |
| 56 | WORKDIR /root/onos |
David Bainbridge | ff4fb04 | 2015-08-17 12:53:29 -0700 | [diff] [blame] | 57 | ENTRYPOINT ["./bin/onos-service"] |