| Mike Marchetti | 182bd73 | 2018-09-05 09:52:42 -0400 | [diff] [blame] | 1 | # This creates osm/NBI docker from local NBI source code |
| 2 | |
| 3 | FROM ubuntu:16.04 |
| 4 | |
| 5 | RUN apt-get update && apt-get -y install curl software-properties-common |
| 6 | |
| Mike Marchetti | 13d76c8 | 2018-09-19 15:00:36 -0400 | [diff] [blame^] | 7 | RUN apt-get update && apt-get install -y git python3 python3-jsonschema \ |
| 8 | python3-pymongo python3-yaml python3-pip \ |
| 9 | && pip3 install pip==9.0.3 \ |
| 10 | && pip3 install aiokafka cherrypy pyangbind \ |
| 11 | && mkdir -p /app/storage/kafka && mkdir -p /app/log |
| 12 | |
| Mike Marchetti | 182bd73 | 2018-09-05 09:52:42 -0400 | [diff] [blame] | 13 | ARG REPOSITORY_BASE=http://osm-download.etsi.org/repository/osm/debian |
| 14 | ARG RELEASE=ReleaseFOUR-daily |
| 15 | ARG REPOSITORY_KEY=OSM%20ETSI%20Release%20Key.gpg |
| 16 | ARG REPOSITORY=testing |
| 17 | |
| 18 | RUN curl ${REPOSITORY_BASE}/${RELEASE}/${REPOSITORY_KEY} | apt-key add - |
| 19 | RUN add-apt-repository -y "deb ${REPOSITORY_BASE}/${RELEASE} ${REPOSITORY} NBI IM common" && apt update |
| 20 | |
| Mike Marchetti | 13d76c8 | 2018-09-19 15:00:36 -0400 | [diff] [blame^] | 21 | ARG NBI_VERSION |
| 22 | ARG COMMON_VERSION |
| 23 | ARG IM_VERSION |
| 24 | |
| 25 | RUN apt-get update && apt-get -y install python3-osm-nbi${NBI_VERSION} python3-osm-common${COMMON_VERSION} python3-osm-im${IM_VERSION} |
| Mike Marchetti | 182bd73 | 2018-09-05 09:52:42 -0400 | [diff] [blame] | 26 | |
| 27 | # Set the working directory to /app |
| 28 | WORKDIR /app/osm_nbi |
| 29 | |
| Mike Marchetti | 182bd73 | 2018-09-05 09:52:42 -0400 | [diff] [blame] | 30 | EXPOSE 9999 |
| 31 | |
| Mike Marchetti | 13d76c8 | 2018-09-19 15:00:36 -0400 | [diff] [blame^] | 32 | RUN cp -R /usr/lib/python3/dist-packages/osm_nbi/html_public /app/osm_nbi/html_public |
| 33 | RUN cp /usr/lib/python3/dist-packages/osm_nbi/nbi.cfg /app/osm_nbi/ |
| 34 | RUN cp -R /usr/lib/python3/dist-packages/osm_nbi/http /app/osm_nbi/ |
| 35 | |
| Mike Marchetti | 182bd73 | 2018-09-05 09:52:42 -0400 | [diff] [blame] | 36 | LABEL Maintainer="alfonso.tiernosepulveda@telefonica.com" \ |
| 37 | Description="This implements a north bound interface for OSM" \ |
| 38 | Version="1.0" \ |
| 39 | Author="Alfonso Tierno" |
| 40 | |
| 41 | # Used for local storage |
| 42 | VOLUME /app/storage |
| 43 | # Used for logs |
| 44 | VOLUME /app/log |
| 45 | |
| 46 | # The following ENV can be added with "docker run -e xxx' to configure |
| 47 | # server |
| 48 | ENV OSMNBI_SOCKET_HOST 0.0.0.0 |
| 49 | ENV OSMNBI_SOCKET_PORT 9999 |
| 50 | # storage |
| 51 | ENV OSMNBI_STORAGE_PATH /app/storage |
| 52 | # database |
| 53 | ENV OSMNBI_DATABASE_DRIVER mongo |
| 54 | ENV OSMNBI_DATABASE_HOST mongo |
| 55 | ENV OSMNBI_DATABASE_PORT 27017 |
| 56 | # web |
| Mike Marchetti | 13d76c8 | 2018-09-19 15:00:36 -0400 | [diff] [blame^] | 57 | ENV OSMNBI_STATIC_DIR /app/osm_nbi/html_public |
| Mike Marchetti | 182bd73 | 2018-09-05 09:52:42 -0400 | [diff] [blame] | 58 | # logs |
| 59 | ENV OSMNBI_LOG_FILE /app/log |
| 60 | ENV OSMNBI_LOG_LEVEL DEBUG |
| 61 | # message |
| 62 | ENV OSMNBI_MESSAGE_DRIVER kafka |
| 63 | ENV OSMNBI_MESSAGE_HOST kafka |
| 64 | ENV OSMNBI_MESSAGE_PORT 9092 |
| 65 | # logs |
| 66 | ENV OSMNBI_LOG_FILE /app/log/nbi.log |
| 67 | ENV OSMNBI_LOG_LEVEL DEBUG |
| 68 | |
| 69 | # Run app.py when the container launches |
| 70 | CMD ["python3", "/usr/lib/python3/dist-packages/osm_nbi/nbi.py"] |