blob: f6ff0016467212696ff96bcbd54ec45314ecd027 [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
garciadeblasc1963832019-12-12 16:58:24 +010021FROM ubuntu:18.04
Mike Marchetti13d76c82018-09-19 15:00:36 -040022
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 \
tierno6a703742020-09-22 09:40:46 +000043 gpg-agent python3-pip \
Michael Marchettib1287f52018-10-31 22:23:02 +000044 python3-all python3-setuptools openssh-client libffi-dev libssl-dev \
tierno6a703742020-09-22 09:40:46 +000045 wget tox python3-cffi \
garciadeblasc1963832019-12-12 16:58:24 +010046 && python3 -m pip install -U pip \
David Garcia358a7c32020-10-21 16:12:04 +020047 && python3 -m pip install -U juju==2.8.4 \
Michael Marchettib1287f52018-10-31 22:23:02 +000048 && rm -rf /var/lib/apt/lists/*
garciadeblas77f468c2018-10-26 23:13:37 +020049
tierno38e11d72018-10-30 14:56:28 +010050# RUN git clone https://osm.etsi.org/gerrit/osm/N2VC.git \
51# && cd N2VC \
52# && cd modules/libjuju && python3 setup.py develop && cd ../.. \
calvinosanchbfb77902019-07-31 13:31:16 +000053# && python3 -m pip install -U -r requirements.txt
Mike Marchetti13d76c82018-09-19 15:00:36 -040054
garciadeblasc1963832019-12-12 16:58:24 +010055RUN apt-get update && apt-get install -y curl xz-utils apt-transport-https \
garciadeblas0ccc31e2019-11-22 15:28:50 +010056 && curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add - \
57 && echo "deb https://apt.kubernetes.io/ kubernetes-xenial main" | tee -a /etc/apt/sources.list.d/kubernetes.list \
58 && apt-get update && apt-get install -y kubectl
59
60RUN curl https://get.helm.sh/helm-v2.15.2-linux-amd64.tar.gz --output helm-v2.15.2.tar.gz \
61 && tar -zxvf helm-v2.15.2.tar.gz \
62 && mv linux-amd64/helm /usr/local/bin/helm \
63 && rm -r linux-amd64/
64
Dominik Fleischmann40e73bf2020-05-21 14:05:24 +020065RUN curl -L https://launchpad.net/juju/2.7/2.7.6/+download/juju-2.7.6-k8s.tar.xz --output juju-2.7.6-k8s.tar.xz \
66 && tar -xvf juju-2.7.6-k8s.tar.xz \
Adam Israel3f16fd52019-12-03 10:14:06 -050067 && mv juju /usr/local/bin/juju
68
Mike Marchetti13d76c82018-09-19 15:00:36 -040069ARG REPOSITORY_BASE=http://osm-download.etsi.org/repository/osm/debian
beierlma4a37f72020-06-26 12:55:01 -040070ARG RELEASE=ReleaseEIGHT-daily
Mike Marchetti13d76c82018-09-19 15:00:36 -040071ARG REPOSITORY_KEY=OSM%20ETSI%20Release%20Key.gpg
72ARG REPOSITORY=testing
73
74RUN curl ${REPOSITORY_BASE}/${RELEASE}/${REPOSITORY_KEY} | apt-key add -
75RUN add-apt-repository -y "deb ${REPOSITORY_BASE}/${RELEASE} ${REPOSITORY} LCM N2VC common" && apt update
76
David Garcia5ac97812019-12-09 10:18:58 +010077RUN python3 -m pip install -U "cffi==1.13.2"
78
Mike Marchetti13d76c82018-09-19 15:00:36 -040079ARG LCM_VERSION
80ARG COMMON_VERSION
81ARG N2VC_VERSION
82
tierno7ce7f4d2020-07-13 15:34:16 +000083RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \
84 python3-osm-lcm${LCM_VERSION} \
85 python3-osm-common${COMMON_VERSION} \
86 python3-n2vc${N2VC_VERSION} \
87 && rm -rf /var/lib/apt/lists/*
Mike Marchetti13d76c82018-09-19 15:00:36 -040088
Mike Marchetti13d76c82018-09-19 15:00:36 -040089LABEL Maintainer="alfonso.tiernosepulveda@telefonica.com" \
90 Description="This implements life cycle management engine for OSM" \
91 Version="1.0" \
92 Author="Alfonso Tierno"
93
94# Used for local storage
95VOLUME /app/storage
96# Used for logs
97VOLUME /app/log
98
99# The following ENV can be added with "docker run -e xxx' to configure LCM
100ENV OSMLCM_RO_HOST ro
101ENV OSMLCM_RO_PORT 9090
102ENV OSMLCM_RO_TENANT osm
103
104# VCA
105ENV OSMLCM_VCA_HOST vca
garciadeblasa2e41842019-12-18 11:05:24 +0100106ENV OSMLCM_VCA_PORT 17070
107ENV OSMLCM_VCA_USER admin
108ENV OSMLCM_VCA_SECRET secret
109# ENV OSMLCM_VCA_PUBKEY pubkey
110# ENV OSMLCM_VCA_CACERT cacert
111# ENV OSMLCM_VCA_ENABLEOSUPGRADE false
112# ENV OSMLCM_VCA_APTMIRROR http://archive.ubuntu.com/ubuntu/
Mike Marchetti13d76c82018-09-19 15:00:36 -0400113
114# database
115ENV OSMLCM_DATABASE_DRIVER mongo
Juancc084d72018-11-16 11:08:07 -0300116ENV OSMLCM_DATABASE_URI mongodb://mongo:27017
117#ENV OSMLCM_DATABASE_HOST mongo
118#ENV OSMLCM_DATABASE_PORT 27017
119
120
Mike Marchetti13d76c82018-09-19 15:00:36 -0400121ENV OSMLCM_STORAGE_DRIVER local
122ENV OSMLCM_STORAGE_PATH /app/storage
123
124# message
125ENV OSMLCM_MESSAGE_DRIVER kafka
126ENV OSMLCM_MESSAGE_HOST kafka
127ENV OSMLCM_MESSAGE_PORT 9092
128
garciadeblas0ccc31e2019-11-22 15:28:50 +0100129# k8s
130ENV OSMLCM_VCA_HELMPATH /usr/local/bin/helm
131ENV OSMLCM_VCA_KUBECTLPATH /usr/bin/kubectl
Adam Israel3f16fd52019-12-03 10:14:06 -0500132ENV OSMLCM_VCA_JUJUPATH /usr/local/bin/juju
garciadeblas0ccc31e2019-11-22 15:28:50 +0100133
134# logs
135# ENV OSMLCM_GLOBAL_LOGFILE /app/log/lcm.log
136# ENV OSMLCM_GLOBAL_LOGLEVEL DEBUG
137
tierno9f8b53b2019-09-13 13:19:48 +0000138HEALTHCHECK --start-period=120s --interval=30s --timeout=30s --retries=1 \
tierno62478d12020-01-09 17:25:29 +0000139 CMD python3 -m osm_lcm.lcm_hc || exit 1
tierno84a3c9a2018-10-24 11:02:57 +0200140
141
Mike Marchetti13d76c82018-09-19 15:00:36 -0400142# Run app.py when the container launches
tierno9f8b53b2019-09-13 13:19:48 +0000143CMD python3 -m osm_lcm.lcm
144