Boyuan Yan | 1c27bc7 | 2019-02-15 19:22:19 +0000 | [diff] [blame^] | 1 | # Dockerfile for ODTN container |
| 2 | |
| 3 | # First stage is the build environment |
| 4 | FROM picoded/ubuntu-openjdk-8-jdk as builder |
| 5 | MAINTAINER Boyuan Yan <boyuan@opennetworking.org> |
| 6 | |
| 7 | # Set the environment variables |
| 8 | ENV HOME /root |
| 9 | ENV BUILD_NUMBER docker |
| 10 | ENV JAVA_TOOL_OPTIONS=-Dfile.encoding=UTF8 |
| 11 | |
| 12 | # Copy in the source |
| 13 | COPY onos.tar.gz /src/onos/ |
| 14 | |
| 15 | # Build ONOS |
| 16 | # We extract the tar in the build environment to avoid having to put the tar |
| 17 | # in the runtime environment - this saves a lot of space |
| 18 | # FIXME - dependence on ONOS_ROOT and git at build time is a hack to work around |
| 19 | # build problems |
| 20 | WORKDIR /src/onos |
| 21 | RUN apt-get update && \ |
| 22 | DEBIAN_FRONTEND=noninteractive \ |
| 23 | apt-get install -y zip python git bzip2 build-essential && \ |
| 24 | export ONOS_ROOT=/src/onos && \ |
| 25 | mkdir -p /src/tar && \ |
| 26 | cd /src/tar && \ |
| 27 | tar -xf /src/onos/onos.tar.gz --strip-components=1 && \ |
| 28 | rm -rf /src/onos/bazel-* .git |
| 29 | |
| 30 | # Second stage is the runtime environment |
| 31 | FROM adoptopenjdk/openjdk11:x86_64-ubuntu-jdk-11.0.1.13-slim |
| 32 | |
| 33 | # Change to /root directory |
| 34 | RUN mkdir -p /root/onos |
| 35 | WORKDIR /root/onos |
| 36 | |
| 37 | # Install ONOS |
| 38 | COPY --from=builder /src/tar/ . |
| 39 | |
| 40 | # Configure ONOS to log to stdout |
| 41 | RUN sed -ibak '/log4j.rootLogger=/s/$/, stdout/' $(ls -d apache-karaf-*)/etc/org.ops4j.pax.logging.cfg |
| 42 | |
| 43 | LABEL org.label-schema.name="ONOS" \ |
| 44 | org.label-schema.description="SDN Controller" \ |
| 45 | org.label-schema.usage="http://wiki.onosproject.org" \ |
| 46 | org.label-schema.url="http://onosproject.org" \ |
| 47 | org.label-scheme.vendor="Open Networking Foundation" \ |
| 48 | org.label-schema.schema-version="1.0" |
| 49 | |
| 50 | # Ports |
| 51 | # 6653 - OpenFlow |
| 52 | # 6640 - OVSDB |
| 53 | # 8181 - GUI |
| 54 | # 8101 - ONOS CLI |
| 55 | # 9876 - ONOS intra-cluster communication |
| 56 | EXPOSE 6653 6640 8181 8101 9876 |
| 57 | |
| 58 | # Open SSH server |
| 59 | RUN apt-get update && apt-get install -y openssh-server |
| 60 | RUN mkdir /var/run/sshd |
| 61 | RUN echo 'root:rocks' | chpasswd |
| 62 | EXPOSE 22 |
| 63 | |
| 64 | # Get ready to run command |
| 65 | ENTRYPOINT ["./bin/onos-service"] |
| 66 | CMD ["server"] |