Fix bug 715
[osm/NBI.git] / Dockerfile.fromdeb
1 # Licensed under the Apache License, Version 2.0 (the "License");
2 # you may not use this file except in compliance with the License.
3 # You may obtain a copy of the License at
4 #
5 #    http://www.apache.org/licenses/LICENSE-2.0
6 #
7 # Unless required by applicable law or agreed to in writing, software
8 # distributed under the License is distributed on an "AS IS" BASIS,
9 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
10 # implied.
11 # See the License for the specific language governing permissions and
12 # limitations under the License.
13
14 # This creates osm/NBI docker from from last stable package
15
16 FROM ubuntu:16.04
17
18 ARG REPOSITORY_BASE=http://osm-download.etsi.org/repository/osm/debian
19 ARG RELEASE=ReleaseFIVE
20 ARG REPOSITORY_KEY=OSM%20ETSI%20Release%20Key.gpg
21 ARG REPOSITORY=testing
22
23 RUN apt-get update && apt-get install -y curl software-properties-common
24 RUN curl ${REPOSITORY_BASE}/${RELEASE}/${REPOSITORY_KEY} | apt-key add -
25 RUN add-apt-repository -y "deb ${REPOSITORY_BASE}/${RELEASE} ${REPOSITORY} NBI IM common" && apt update
26
27 RUN apt-get -y install python3-osm-nbi 
28
29 # Set the working directory to /app
30 WORKDIR /app/osm_nbi
31
32 RUN cp -R /usr/lib/python3/dist-packages/osm_nbi/html_public /app/osm_nbi/html_public \
33     && cp /usr/lib/python3/dist-packages/osm_nbi/nbi.cfg /app/osm_nbi/ \
34     && cp -R /usr/lib/python3/dist-packages/osm_nbi/http /app/osm_nbi/
35
36 EXPOSE 9999
37
38 LABEL Maintainer="alfonso.tiernosepulveda@telefonica.com" \
39       Description="This implements a north bound interface for OSM" \
40       Version="1.0" \
41       Author="Alfonso Tierno"
42
43 # Used for local storage
44 VOLUME /app/storage
45 # Used for logs
46 VOLUME /app/log
47
48 # The following ENV can be added with "docker run -e xxx' to configure
49 # server
50 ENV OSMNBI_SOCKET_HOST     0.0.0.0
51 ENV OSMNBI_SOCKET_PORT     9999
52 # storage
53 ENV OSMNBI_STORAGE_PATH    /app/storage
54 # database
55 ENV OSMNBI_DATABASE_DRIVER mongo
56 ENV OSMNBI_DATABASE_URI    mongodb://mongo:27017
57 # web
58 ENV OSMNBI_STATIC_DIR      /app/osm_nbi/html_public
59 # logs
60 # ENV OSMNBI_LOG_FILE        /app/log
61 ENV OSMNBI_LOG_LEVEL       DEBUG
62 # message
63 ENV OSMNBI_MESSAGE_DRIVER  kafka
64 ENV OSMNBI_MESSAGE_HOST    kafka
65 ENV OSMNBI_MESSAGE_PORT    9092
66 # authentication
67 ENV OSMNBI_AUTHENTICATION_BACKEND               internal
68 #ENV OSMNBI_AUTHENTICATION_BACKEND               keystone
69 #ENV OSMNBI_AUTHENTICATION_AUTH_URL              keystone
70 #ENV OSMNBI_AUTHENTICATION_AUTH_PORT             5000
71 #ENV OSMNBI_AUTHENTICATION_USER_DOMAIN_NAME      default
72 #ENV OSMNBI_AUTHENTICATION_PROJECT_DOMAIN_NAME   default
73 #ENV OSMNBI_AUTHENTICATION_SERVICE_USERNAME      nbi
74 #ENV OSMNBI_AUTHENTICATION_SERVICE_PASSWORD      nbi
75 #ENV OSMNBI_AUTHENTICATION_SERVICE_PROJECT       service
76
77 # Run app.py when the container launches
78 CMD ["python3", "/usr/lib/python3/dist-packages/osm_nbi/nbi.py"]
79
80 HEALTHCHECK --interval=5s --timeout=2s --retries=12 \
81   CMD curl -k https://localhost:9999/osm/ | grep Welcome || exit 1
82