blob: 9f340deae973c99648089549ff352685f58fe4e8 [file] [log] [blame]
khenaidoofdbad6e2018-11-06 22:26:38 -05001# Copyright 2016 the original author or authors.
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
Matt Jeanneret2e3051a2019-05-11 15:01:46 -040014FROM ubuntu:16.04
khenaidoofdbad6e2018-11-06 22:26:38 -050015
Matt Jeanneret2e3051a2019-05-11 15:01:46 -040016# Update to have latest images
17RUN apt-get update && \
18 apt-get install -y python openssl iproute2 libpcap-dev wget build-essential git binutils python-dev libffi-dev libssl-dev
khenaidoofdbad6e2018-11-06 22:26:38 -050019
Matt Jeanneret2e3051a2019-05-11 15:01:46 -040020# Install current version of pip rather than outdated pip from apt
21RUN wget -O /tmp/get-pip.py https://bootstrap.pypa.io/get-pip.py
22RUN python /tmp/get-pip.py
23
24# Install adapter requirements.
25COPY requirements.txt /tmp/requirements.txt
26RUN pip install -r /tmp/requirements.txt
27
28ARG LOCAL_PYVOLTHA
29ARG LOCAL_PROTOS
30COPY local_imports/ /local_imports/
31RUN if [ -n "$LOCAL_PYVOLTHA" ] ; then \
32 pip install /local_imports/pyvoltha/dist/*.tar.gz ; \
33fi
34
35RUN if [ -n "$LOCAL_PROTOS" ] ; then \
36 pip install /local_imports/voltha-protos/dist/*.tar.gz ; \
37fi
khenaidoofdbad6e2018-11-06 22:26:38 -050038
39# Bundle app source
40RUN mkdir /voltha && touch /voltha/__init__.py
41ENV PYTHONPATH=/voltha
khenaidoofdbad6e2018-11-06 22:26:38 -050042COPY cli /voltha/python/cli
43RUN touch /voltha/python/__init__.py
44RUN touch /voltha/python/cli/__init__.py
45
khenaidoofdbad6e2018-11-06 22:26:38 -050046# Setup the voltha user
47RUN useradd -b /home -d /home/voltha voltha -s /bin/bash
48RUN mkdir /home/voltha
49RUN chown voltha.voltha /home/voltha
50RUN echo "voltha:admin" | chpasswd
51RUN apt-get update && apt-get install -y openssh-server
52RUN apt-get update && apt-get install -y openssh-server
53RUN mkdir /var/run/sshd
54RUN echo 'root:screencast' | chpasswd
55RUN sed -i 's/PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config
56
57# SSH login fix. Otherwise user is kicked off after login
58RUN sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd
59
60ENV NOTVISIBLE "in users profile"
61RUN echo "export VISIBLE=now" >> /etc/profile
62
63EXPOSE 22
64
65# Exposing process and default entry point
66ENTRYPOINT ["/usr/bin/dumb-init", "--"]
67
68CMD ["/voltha/python/cli/setup.sh"]
Matt Jeanneret2e3051a2019-05-11 15:01:46 -040069
70# Label image
71ARG org_label_schema_version=unknown
72ARG org_label_schema_vcs_url=unknown
73ARG org_label_schema_vcs_ref=unknown
74ARG org_label_schema_build_date=unknown
75ARG org_opencord_vcs_commit_date=unknown
76
77LABEL org.label-schema.schema-version=1.0 \
78 org.label-schema.name=voltha-cli \
79 org.label-schema.version=$org_label_schema_version \
80 org.label-schema.vcs-url=$org_label_schema_vcs_url \
81 org.label-schema.vcs-ref=$org_label_schema_vcs_ref \
82 org.label-schema.build-date=$org_label_schema_build_date \
83 org.opencord.vcs-commit-date=$org_opencord_vcs_commit_date