blob: 75f135c54917fef238294b2c5e83aac26aefcefa [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 && \
David Bainbridge5f3619c2019-07-10 22:51:09 +000018 apt-get install -y --no-install-recommends \
19 ca-certificates=20170717~16.04.2 \
20 python=2.7.12-1~16.04 \
21 openssl=1.0.2g-1ubuntu4.15 \
22 iproute2=4.3.0-1ubuntu3.16.04.5 \
23 libpcap-dev=1.7.4-2 \
24 wget=1.17.1-1ubuntu1.5 \
25 build-essential=12.1ubuntu2 \
26 git=1:2.7.4-0ubuntu1.6 \
27 binutils=2.26.1-1ubuntu1~16.04.8 \
28 python-dev=2.7.12-1~16.04 \
29 libffi-dev=3.2.1-4 \
30 libssl-dev=1.0.2g-1ubuntu4.15 \
31 && apt-get clean && rm -rf /var/lib/apt/lists/*
khenaidoofdbad6e2018-11-06 22:26:38 -050032
Matt Jeanneret2e3051a2019-05-11 15:01:46 -040033# Install current version of pip rather than outdated pip from apt
34RUN wget -O /tmp/get-pip.py https://bootstrap.pypa.io/get-pip.py
35RUN python /tmp/get-pip.py
36
37# Install adapter requirements.
38COPY requirements.txt /tmp/requirements.txt
39RUN pip install -r /tmp/requirements.txt
40
41ARG LOCAL_PYVOLTHA
42ARG LOCAL_PROTOS
43COPY local_imports/ /local_imports/
44RUN if [ -n "$LOCAL_PYVOLTHA" ] ; then \
William Kurkian190e38b2019-07-16 14:54:04 -040045 PYVOLTHA_PATH=$(ls /local_imports/pyvoltha/dist/) ; \
46 printf "/local_imports/pyvoltha/dist/%s\npyvoltha" "$PYVOLTHA_PATH" > pyvoltha-install.txt ; \
47 pip install -r pyvoltha-install.txt ; \
Matt Jeanneret2e3051a2019-05-11 15:01:46 -040048fi
49
50RUN if [ -n "$LOCAL_PROTOS" ] ; then \
William Kurkian190e38b2019-07-16 14:54:04 -040051 PROTOS_PATH=$(ls /local_imports/voltha-protos/dist/) ; \
52 printf "/local_imports/voltha-protos/dist/%s\nvoltha-protos" "$PROTOS_PATH" > protos-install.txt ; \
53 pip install -r protos-install.txt ; \
Matt Jeanneret2e3051a2019-05-11 15:01:46 -040054fi
khenaidoofdbad6e2018-11-06 22:26:38 -050055
56# Bundle app source
57RUN mkdir /voltha && touch /voltha/__init__.py
58ENV PYTHONPATH=/voltha
khenaidoofdbad6e2018-11-06 22:26:38 -050059COPY adapters/ponsim_olt /voltha/python/adapters/ponsim_olt
60RUN touch /voltha/python/__init__.py
61RUN touch /voltha/python/adapters/__init__.py
62
khenaidoofdbad6e2018-11-06 22:26:38 -050063# Exposing process and default entry point
William Kurkianfc0dcda2019-04-08 16:54:36 -040064CMD ["python", "/voltha/python/adapters/ponsim_olt/main.py"]
Matt Jeanneret2e3051a2019-05-11 15:01:46 -040065
66# Label image
67ARG org_label_schema_version=unknown
68ARG org_label_schema_vcs_url=unknown
69ARG org_label_schema_vcs_ref=unknown
70ARG org_label_schema_build_date=unknown
71ARG org_opencord_vcs_commit_date=unknown
72
73LABEL org.label-schema.schema-version=1.0 \
74 org.label-schema.name=voltha-adapter-ponsim-olt \
75 org.label-schema.version=$org_label_schema_version \
76 org.label-schema.vcs-url=$org_label_schema_vcs_url \
77 org.label-schema.vcs-ref=$org_label_schema_vcs_ref \
78 org.label-schema.build-date=$org_label_schema_build_date \
79 org.opencord.vcs-commit-date=$org_opencord_vcs_commit_date