blob: 0a9703d923cb62f266f0de26e9fac070989f58d3 [file] [log] [blame]
Eric Tang58b773d2019-02-22 14:03:36 +08001FROM ubuntu:18.04
2LABEL maintainer="Eric Tang <qcorba at gmail.com>"
3
4ARG ATOMIX_VERSION
5ENV ENV_ATOMIX_VERSION=${ATOMIX_VERSION:-3.1.5}
6
7RUN apt-get update
8RUN DEBIAN_FRONTEND=noninteractive apt-get -y install \
9 --no-install-recommends \
10 openjdk-11-jre \
11 python-setuptools \
12 python-pip \
13 openssh-server \
14 supervisor \
15 vim-tiny \
16 net-tools \
17 iputils-ping \
18 curl \
19 sudo
20
21RUN set -eux; \
22 groupadd -r sdn; \
23 useradd -m -r -s /bin/bash -g sdn sdn; \
24 echo sdn:sdn | chpasswd; \
25 echo 'sdn ALL=(ALL:ALL) NOPASSWD:ALL' > /etc/sudoers.d/sdn
26
27USER sdn
28RUN mkdir /home/sdn/.ssh
29RUN ssh-keygen -t rsa -N "" -f /home/sdn/.ssh/id_rsa
30
31USER root
32COPY --chown=sdn:sdn id_rsa.pub /home/sdn/.ssh/authorized_keys
33RUN chmod 600 /home/sdn/.ssh/authorized_keys
34
35# Configure supervisor
36RUN set -eux; \
37 mv /etc/supervisor/supervisord.conf /etc/supervisor/supervisord-orig.conf; \
38 mkdir -p /var/log/supervisor; \
39 mkdir -p /var/run/sshd; \
40 chmod 700 /var/run/sshd
41COPY supervisord.conf /etc/supervisor/
42COPY supervisord-sshd.conf /etc/supervisor/conf.d/sshd.conf
43COPY supervisord-onos.conf /etc/supervisor/conf.d/onos.conf
44COPY supervisord-atomix.conf /etc/supervisor/conf.d/atomix.conf
45
46# Install ONOS
47COPY onos.tar.gz /tmp/
48RUN set -eux; \
49 mkdir /opt/onos; \
50 tar zxmf /tmp/onos.tar.gz -C /opt/onos --strip-components=1; \
51 ln -s /opt/onos/apache-karaf-* /opt/onos/karaf; \
52 ln -s /opt/onos/karaf/data/log /opt/onos/log; \
53 mkdir /opt/onos/var; \
54 mkdir /opt/onos/config; \
55 # Install the configuration file(s)
56 #cp /opt/onos/init/onos.conf /etc/init/onos.conf; \
57 cp /opt/onos/init/onos.initd /etc/init.d/onos; \
58 cp /opt/onos/init/onos.service /etc/systemd/system/onos.service; \
59 # Set up options for debugging
60 echo 'export ONOS_OPTS=debug' > /opt/onos/options; \
61 # Set up correct user to run onos-service
62 echo 'export ONOS_USER=sdn' >> /opt/onos/options; \
63 # Configure ONOS to log to stdout
64 sed -ibak '/log4j.rootLogger=/s/$/, stdout/' $(ls -d /opt/onos/apache-karaf-*)/etc/org.ops4j.pax.logging.cfg; \
65 chown -R sdn:sdn /opt/onos
66
67# Install Atomix
68RUN set -eux; \
69# curl -o /tmp/atomix.tar.gz -XGET https://oss.sonatype.org/content/repositories/releases/io/atomix/atomix-dist/3.1.5/atomix-dist-3.1.5.tar.gz; \
70 curl -o /tmp/atomix.tar.gz https://repo1.maven.org/maven2/io/atomix/atomix-dist/$ENV_ATOMIX_VERSION/atomix-dist-$ENV_ATOMIX_VERSION.tar.gz; \
71 mkdir /opt/atomix; \
72 tar zxmf /tmp/atomix.tar.gz -C /opt/atomix; \
73 chown -R sdn:sdn /opt/atomix
74
75# Ports
76# 22 - sshd
77# 80 - supervisord
78# 5678 - Atomix REST API
79# 5679 - Atomix intra-cluster communication
80# 6633 - OpenFlow legacy
81# 6640 - OVSDB
82# 6653 - OpenFlow IANA assigned
83# 8101 - ONOS CLI
84# 8181 - ONOS GUI
85# 9876 - ONOS intra-cluster communication
86EXPOSE 22 5678 5679 6633 6640 6653 8101 8181 9876
87#EXPOSE 80
88
89CMD ["/usr/bin/supervisord", "-n"]