Scott Baker | 8173950 | 2019-10-14 16:53:10 -0700 | [diff] [blame] | 1 | # 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 Jeanneret | d78f7ba | 2019-10-23 11:28:56 -0400 | [diff] [blame^] | 14 | FROM voltha/voltha-python-base:1.0.0 |
Scott Baker | 8173950 | 2019-10-14 16:53:10 -0700 | [diff] [blame] | 15 | |
| 16 | # Install adapter requirements. |
| 17 | COPY requirements.txt /tmp/requirements.txt |
| 18 | RUN pip install -r /tmp/requirements.txt |
| 19 | |
| 20 | ARG LOCAL_PYVOLTHA |
| 21 | ARG LOCAL_PROTOS |
| 22 | COPY local_imports/ /local_imports/ |
| 23 | RUN if [ -n "$LOCAL_PYVOLTHA" ] ; then \ |
| 24 | PYVOLTHA_PATH=$(ls /local_imports/pyvoltha/dist/) ; \ |
| 25 | printf "/local_imports/pyvoltha/dist/%s\npyvoltha" "$PYVOLTHA_PATH" > pyvoltha-install.txt ; \ |
| 26 | pip install -r pyvoltha-install.txt ; \ |
| 27 | fi |
| 28 | |
| 29 | RUN if [ -n "$LOCAL_PROTOS" ] ; then \ |
| 30 | PROTOS_PATH=$(ls /local_imports/voltha-protos/dist/) ; \ |
| 31 | printf "/local_imports/voltha-protos/dist/%s\nvoltha-protos" "$PROTOS_PATH" > protos-install.txt ; \ |
| 32 | pip install -r protos-install.txt ; \ |
| 33 | fi |
| 34 | |
| 35 | # Bundle app source |
| 36 | RUN mkdir /voltha && touch /voltha/__init__.py |
| 37 | ENV PYTHONPATH=/voltha |
| 38 | COPY ponsim_onu /voltha/python/adapters/ponsim_onu |
| 39 | COPY VERSION /voltha/python/adapters/ponsim_onu |
| 40 | RUN touch /voltha/python/__init__.py |
| 41 | RUN touch /voltha/python/adapters/__init__.py |
| 42 | |
| 43 | # Exposing process and default entry point |
| 44 | CMD ["python", "/voltha/python/adapters/ponsim_onu/main.py"] |
| 45 | |
| 46 | # Label image |
| 47 | ARG org_label_schema_version=unknown |
| 48 | ARG org_label_schema_vcs_url=unknown |
| 49 | ARG org_label_schema_vcs_ref=unknown |
| 50 | ARG org_label_schema_build_date=unknown |
| 51 | ARG org_opencord_vcs_commit_date=unknown |
| 52 | |
| 53 | LABEL org.label-schema.schema-version=1.0 \ |
| 54 | org.label-schema.name=voltha-adapter-ponsim-onu \ |
| 55 | org.label-schema.version=$org_label_schema_version \ |
| 56 | org.label-schema.vcs-url=$org_label_schema_vcs_url \ |
| 57 | org.label-schema.vcs-ref=$org_label_schema_vcs_ref \ |
| 58 | org.label-schema.build-date=$org_label_schema_build_date \ |
| 59 | org.opencord.vcs-commit-date=$org_opencord_vcs_commit_date |