blob: d589ba01b7b600fd0469622bad84e994b295c208 [file] [log] [blame]
Boyuan Yan1c27bc72019-02-15 19:22:19 +00001# Dockerfile for ODTN container
2
3# First stage is the build environment
4FROM picoded/ubuntu-openjdk-8-jdk as builder
5MAINTAINER Boyuan Yan <boyuan@opennetworking.org>
6
7# Set the environment variables
8ENV HOME /root
9ENV BUILD_NUMBER docker
10ENV JAVA_TOOL_OPTIONS=-Dfile.encoding=UTF8
11
12# Copy in the source
13COPY 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
20WORKDIR /src/onos
21RUN 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
31FROM adoptopenjdk/openjdk11:x86_64-ubuntu-jdk-11.0.1.13-slim
32
33# Change to /root directory
34RUN mkdir -p /root/onos
35WORKDIR /root/onos
36
37# Install ONOS
38COPY --from=builder /src/tar/ .
39
40# Configure ONOS to log to stdout
41RUN sed -ibak '/log4j.rootLogger=/s/$/, stdout/' $(ls -d apache-karaf-*)/etc/org.ops4j.pax.logging.cfg
42
43LABEL 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
56EXPOSE 6653 6640 8181 8101 9876
57
58# Open SSH server
59RUN apt-get update && apt-get install -y openssh-server
60RUN mkdir /var/run/sshd
61RUN echo 'root:rocks' | chpasswd
62EXPOSE 22
63
64# Get ready to run command
65ENTRYPOINT ["./bin/onos-service"]
66CMD ["server"]