blob: f141f92e352f26113ae8f75bb4a29257f1c51f0d [file] [log] [blame]
calvinosanchbfb77902019-07-31 13:31:16 +00001##
2# Copyright 2019 ETSI
3#
4# Licensed under the Apache License, Version 2.0 (the "License"); you may
5# not use this file except in compliance with the License. You may obtain
6# a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13# License for the specific language governing permissions and limitations
14# under the License.
15##
16
17########################################################################
18
Mike Marchetti13d76c82018-09-19 15:00:36 -040019# This creates som/LCM docker from from last stable package
20
21FROM ubuntu:16.04
22
23# Set the working directory to /app
24WORKDIR /app/osm_lcm
25
26# avoid extra information from packages
27RUN echo 'path-exclude /usr/share/doc/*\n\
28path-include /usr/share/doc/*/copyright\n\
29path-exclude /usr/share/man/*\n\
30path-exclude /usr/share/groff/*\n\
31path-exclude /usr/share/info/*\n\
32path-exclude /usr/share/lintian/*\n\
33path-exclude /usr/share/linda/*\n'\
34> /etc/dpkg/dpkg.cfg.d/01_nodoc && \
35 echo 'APT::Install-Recommends "false";\n\
36APT::AutoRemove::RecommendsImportant "false";\n\
37APT::AutoRemove::SuggestsImportant "false";\n'\
38> /etc/apt/apt.conf.d/99_norecommends
39
40RUN apt-get update && apt-get -y install curl software-properties-common
41
madavi2f3a6c32019-12-02 16:45:19 +053042RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y git make python3 \
Adam Israelca079d72019-11-19 13:05:22 +010043 python3-pip python3-pymongo python3-aiohttp \
Michael Marchettib1287f52018-10-31 22:23:02 +000044 python3-all python3-setuptools openssh-client libffi-dev libssl-dev \
Mike Marchetti13d76c82018-09-19 15:00:36 -040045 python3-bitarray python3-regex python3-lxml dh-python wget tox \
46 python3-cffi \
garciadeblas0ccc31e2019-11-22 15:28:50 +010047 && python3 -m pip install pip --upgrade \
Adam Israelca079d72019-11-19 13:05:22 +010048 && python3 -m pip install -U aiokafka lxml six enum34 \
calvinosanchbfb77902019-07-31 13:31:16 +000049 && python3 -m pip install requests \
garciadeblas0ccc31e2019-11-22 15:28:50 +010050 && python3 -m pip install -U juju \
Michael Marchettib1287f52018-10-31 22:23:02 +000051 && rm -rf /var/lib/apt/lists/*
garciadeblas77f468c2018-10-26 23:13:37 +020052
tierno38e11d72018-10-30 14:56:28 +010053# RUN git clone https://osm.etsi.org/gerrit/osm/N2VC.git \
54# && cd N2VC \
55# && cd modules/libjuju && python3 setup.py develop && cd ../.. \
calvinosanchbfb77902019-07-31 13:31:16 +000056# && python3 -m pip install -U -r requirements.txt
Mike Marchetti13d76c82018-09-19 15:00:36 -040057
Adam Israel3f16fd52019-12-03 10:14:06 -050058RUN apt-get update && apt-get install -y curl xz-utils \
garciadeblas0ccc31e2019-11-22 15:28:50 +010059 && apt-get update && apt-get install -y apt-transport-https \
60 && curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add - \
61 && echo "deb https://apt.kubernetes.io/ kubernetes-xenial main" | tee -a /etc/apt/sources.list.d/kubernetes.list \
62 && apt-get update && apt-get install -y kubectl
63
64RUN curl https://get.helm.sh/helm-v2.15.2-linux-amd64.tar.gz --output helm-v2.15.2.tar.gz \
65 && tar -zxvf helm-v2.15.2.tar.gz \
66 && mv linux-amd64/helm /usr/local/bin/helm \
67 && rm -r linux-amd64/
68
Adam Israel3f16fd52019-12-03 10:14:06 -050069RUN curl -L https://launchpad.net/juju/2.7/2.7.0/+download/juju-2.7.0-k8s.tar.xz --output juju-2.7.0-k8s.tar.xz \
70 && tar -xvf juju-2.7.0-k8s.tar.xz \
71 && mv juju /usr/local/bin/juju
72
Mike Marchetti13d76c82018-09-19 15:00:36 -040073ARG REPOSITORY_BASE=http://osm-download.etsi.org/repository/osm/debian
74ARG RELEASE=ReleaseFOUR-daily
75ARG REPOSITORY_KEY=OSM%20ETSI%20Release%20Key.gpg
76ARG REPOSITORY=testing
77
78RUN curl ${REPOSITORY_BASE}/${RELEASE}/${REPOSITORY_KEY} | apt-key add -
79RUN add-apt-repository -y "deb ${REPOSITORY_BASE}/${RELEASE} ${REPOSITORY} LCM N2VC common" && apt update
80
David Garcia5ac97812019-12-09 10:18:58 +010081RUN python3 -m pip install -U "cffi==1.13.2"
82
Mike Marchetti13d76c82018-09-19 15:00:36 -040083ARG LCM_VERSION
84ARG COMMON_VERSION
85ARG N2VC_VERSION
86
87RUN apt-get update && apt-get install -y python3-osm-lcm${LCM_VERSION} \
88 python3-osm-common${COMMON_VERSION} \
89 python3-n2vc${N2VC_VERSION} \
90 && rm -rf /var/lib/apt/lists/*
91
92EXPOSE 9999
93
94LABEL Maintainer="alfonso.tiernosepulveda@telefonica.com" \
95 Description="This implements life cycle management engine for OSM" \
96 Version="1.0" \
97 Author="Alfonso Tierno"
98
99# Used for local storage
100VOLUME /app/storage
101# Used for logs
102VOLUME /app/log
103
104# The following ENV can be added with "docker run -e xxx' to configure LCM
105ENV OSMLCM_RO_HOST ro
106ENV OSMLCM_RO_PORT 9090
107ENV OSMLCM_RO_TENANT osm
108
109# VCA
110ENV OSMLCM_VCA_HOST vca
111ENV OSMLCM_VCA_PORT: 17070
112ENV OSMLCM_VCA_USER: admin
113ENV OSMLCM_VCA_SECRET: secret
114
115# database
116ENV OSMLCM_DATABASE_DRIVER mongo
Juancc084d72018-11-16 11:08:07 -0300117ENV OSMLCM_DATABASE_URI mongodb://mongo:27017
118#ENV OSMLCM_DATABASE_HOST mongo
119#ENV OSMLCM_DATABASE_PORT 27017
120
121
Mike Marchetti13d76c82018-09-19 15:00:36 -0400122ENV OSMLCM_STORAGE_DRIVER local
123ENV OSMLCM_STORAGE_PATH /app/storage
124
125# message
126ENV OSMLCM_MESSAGE_DRIVER kafka
127ENV OSMLCM_MESSAGE_HOST kafka
128ENV OSMLCM_MESSAGE_PORT 9092
129
garciadeblas0ccc31e2019-11-22 15:28:50 +0100130# k8s
131ENV OSMLCM_VCA_HELMPATH /usr/local/bin/helm
132ENV OSMLCM_VCA_KUBECTLPATH /usr/bin/kubectl
Adam Israel3f16fd52019-12-03 10:14:06 -0500133ENV OSMLCM_VCA_JUJUPATH /usr/local/bin/juju
garciadeblas0ccc31e2019-11-22 15:28:50 +0100134
135# logs
136# ENV OSMLCM_GLOBAL_LOGFILE /app/log/lcm.log
137# ENV OSMLCM_GLOBAL_LOGLEVEL DEBUG
138
tierno9f8b53b2019-09-13 13:19:48 +0000139HEALTHCHECK --start-period=120s --interval=30s --timeout=30s --retries=1 \
140 CMD python3 -m osm_lcm.lcm --health-check || exit 1
tierno84a3c9a2018-10-24 11:02:57 +0200141
142
Mike Marchetti13d76c82018-09-19 15:00:36 -0400143# Run app.py when the container launches
tierno9f8b53b2019-09-13 13:19:48 +0000144CMD python3 -m osm_lcm.lcm
145