| calvinosanch | bfb7790 | 2019-07-31 13:31:16 +0000 | [diff] [blame] | 1 | ## |
| 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 Marchetti | 13d76c8 | 2018-09-19 15:00:36 -0400 | [diff] [blame] | 19 | # This creates som/LCM docker from from last stable package |
| 20 | |
| garciadeblas | c196383 | 2019-12-12 16:58:24 +0100 | [diff] [blame] | 21 | FROM ubuntu:18.04 |
| Mike Marchetti | 13d76c8 | 2018-09-19 15:00:36 -0400 | [diff] [blame] | 22 | |
| 23 | # Set the working directory to /app |
| 24 | WORKDIR /app/osm_lcm |
| 25 | |
| 26 | # avoid extra information from packages |
| 27 | RUN echo 'path-exclude /usr/share/doc/*\n\ |
| 28 | path-include /usr/share/doc/*/copyright\n\ |
| 29 | path-exclude /usr/share/man/*\n\ |
| 30 | path-exclude /usr/share/groff/*\n\ |
| 31 | path-exclude /usr/share/info/*\n\ |
| 32 | path-exclude /usr/share/lintian/*\n\ |
| 33 | path-exclude /usr/share/linda/*\n'\ |
| 34 | > /etc/dpkg/dpkg.cfg.d/01_nodoc && \ |
| 35 | echo 'APT::Install-Recommends "false";\n\ |
| 36 | APT::AutoRemove::RecommendsImportant "false";\n\ |
| 37 | APT::AutoRemove::SuggestsImportant "false";\n'\ |
| 38 | > /etc/apt/apt.conf.d/99_norecommends |
| 39 | |
| 40 | RUN apt-get update && apt-get -y install curl software-properties-common |
| 41 | |
| madavi | 2f3a6c3 | 2019-12-02 16:45:19 +0530 | [diff] [blame] | 42 | RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y git make python3 \ |
| tierno | 6a70374 | 2020-09-22 09:40:46 +0000 | [diff] [blame] | 43 | gpg-agent python3-pip \ |
| Michael Marchetti | b1287f5 | 2018-10-31 22:23:02 +0000 | [diff] [blame] | 44 | python3-all python3-setuptools openssh-client libffi-dev libssl-dev \ |
| tierno | 6a70374 | 2020-09-22 09:40:46 +0000 | [diff] [blame] | 45 | wget tox python3-cffi \ |
| garciadeblas | c196383 | 2019-12-12 16:58:24 +0100 | [diff] [blame] | 46 | && python3 -m pip install -U pip \ |
| David Garcia | 358a7c3 | 2020-10-21 16:12:04 +0200 | [diff] [blame] | 47 | && python3 -m pip install -U juju==2.8.4 \ |
| David Garcia | 1fcc259 | 2020-11-11 16:53:07 +0100 | [diff] [blame] | 48 | && python3 -m pip install -U kubernetes==10.0.1 \ |
| Michael Marchetti | b1287f5 | 2018-10-31 22:23:02 +0000 | [diff] [blame] | 49 | && rm -rf /var/lib/apt/lists/* |
| garciadeblas | 77f468c | 2018-10-26 23:13:37 +0200 | [diff] [blame] | 50 | |
| tierno | 38e11d7 | 2018-10-30 14:56:28 +0100 | [diff] [blame] | 51 | # RUN git clone https://osm.etsi.org/gerrit/osm/N2VC.git \ |
| 52 | # && cd N2VC \ |
| 53 | # && cd modules/libjuju && python3 setup.py develop && cd ../.. \ |
| calvinosanch | bfb7790 | 2019-07-31 13:31:16 +0000 | [diff] [blame] | 54 | # && python3 -m pip install -U -r requirements.txt |
| Mike Marchetti | 13d76c8 | 2018-09-19 15:00:36 -0400 | [diff] [blame] | 55 | |
| garciadeblas | c196383 | 2019-12-12 16:58:24 +0100 | [diff] [blame] | 56 | RUN apt-get update && apt-get install -y curl xz-utils apt-transport-https \ |
| garciadeblas | 0ccc31e | 2019-11-22 15:28:50 +0100 | [diff] [blame] | 57 | && curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add - \ |
| 58 | && echo "deb https://apt.kubernetes.io/ kubernetes-xenial main" | tee -a /etc/apt/sources.list.d/kubernetes.list \ |
| 59 | && apt-get update && apt-get install -y kubectl |
| 60 | |
| 61 | RUN curl https://get.helm.sh/helm-v2.15.2-linux-amd64.tar.gz --output helm-v2.15.2.tar.gz \ |
| 62 | && tar -zxvf helm-v2.15.2.tar.gz \ |
| 63 | && mv linux-amd64/helm /usr/local/bin/helm \ |
| 64 | && rm -r linux-amd64/ |
| 65 | |
| lloretgalleg | 5926de2 | 2020-11-16 10:27:49 +0000 | [diff] [blame] | 66 | RUN curl https://get.helm.sh/helm-v3.3.4-linux-amd64.tar.gz --output helm-v3.3.4.tar.gz \ |
| 67 | && tar -zxvf helm-v3.3.4.tar.gz \ |
| 68 | && mv linux-amd64/helm /usr/local/bin/helm3 \ |
| 69 | && rm -r linux-amd64/ |
| 70 | |
| Dominik Fleischmann | 40e73bf | 2020-05-21 14:05:24 +0200 | [diff] [blame] | 71 | RUN 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 \ |
| 72 | && tar -xvf juju-2.7.6-k8s.tar.xz \ |
| Adam Israel | 3f16fd5 | 2019-12-03 10:14:06 -0500 | [diff] [blame] | 73 | && mv juju /usr/local/bin/juju |
| 74 | |
| Mike Marchetti | 13d76c8 | 2018-09-19 15:00:36 -0400 | [diff] [blame] | 75 | ARG REPOSITORY_BASE=http://osm-download.etsi.org/repository/osm/debian |
| beierlm | a4a37f7 | 2020-06-26 12:55:01 -0400 | [diff] [blame] | 76 | ARG RELEASE=ReleaseEIGHT-daily |
| Mike Marchetti | 13d76c8 | 2018-09-19 15:00:36 -0400 | [diff] [blame] | 77 | ARG REPOSITORY_KEY=OSM%20ETSI%20Release%20Key.gpg |
| 78 | ARG REPOSITORY=testing |
| 79 | |
| 80 | RUN curl ${REPOSITORY_BASE}/${RELEASE}/${REPOSITORY_KEY} | apt-key add - |
| 81 | RUN add-apt-repository -y "deb ${REPOSITORY_BASE}/${RELEASE} ${REPOSITORY} LCM N2VC common" && apt update |
| 82 | |
| David Garcia | 5ac9781 | 2019-12-09 10:18:58 +0100 | [diff] [blame] | 83 | RUN python3 -m pip install -U "cffi==1.13.2" |
| 84 | |
| Mike Marchetti | 13d76c8 | 2018-09-19 15:00:36 -0400 | [diff] [blame] | 85 | ARG LCM_VERSION |
| 86 | ARG COMMON_VERSION |
| 87 | ARG N2VC_VERSION |
| 88 | |
| tierno | 7ce7f4d | 2020-07-13 15:34:16 +0000 | [diff] [blame] | 89 | RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \ |
| 90 | python3-osm-lcm${LCM_VERSION} \ |
| 91 | python3-osm-common${COMMON_VERSION} \ |
| 92 | python3-n2vc${N2VC_VERSION} \ |
| 93 | && rm -rf /var/lib/apt/lists/* |
| Mike Marchetti | 13d76c8 | 2018-09-19 15:00:36 -0400 | [diff] [blame] | 94 | |
| Mike Marchetti | 13d76c8 | 2018-09-19 15:00:36 -0400 | [diff] [blame] | 95 | LABEL Maintainer="alfonso.tiernosepulveda@telefonica.com" \ |
| 96 | Description="This implements life cycle management engine for OSM" \ |
| 97 | Version="1.0" \ |
| 98 | Author="Alfonso Tierno" |
| 99 | |
| 100 | # Used for local storage |
| 101 | VOLUME /app/storage |
| 102 | # Used for logs |
| 103 | VOLUME /app/log |
| 104 | |
| 105 | # The following ENV can be added with "docker run -e xxx' to configure LCM |
| 106 | ENV OSMLCM_RO_HOST ro |
| 107 | ENV OSMLCM_RO_PORT 9090 |
| 108 | ENV OSMLCM_RO_TENANT osm |
| 109 | |
| 110 | # VCA |
| 111 | ENV OSMLCM_VCA_HOST vca |
| garciadeblas | a2e4184 | 2019-12-18 11:05:24 +0100 | [diff] [blame] | 112 | ENV OSMLCM_VCA_PORT 17070 |
| 113 | ENV OSMLCM_VCA_USER admin |
| 114 | ENV OSMLCM_VCA_SECRET secret |
| 115 | # ENV OSMLCM_VCA_PUBKEY pubkey |
| 116 | # ENV OSMLCM_VCA_CACERT cacert |
| 117 | # ENV OSMLCM_VCA_ENABLEOSUPGRADE false |
| 118 | # ENV OSMLCM_VCA_APTMIRROR http://archive.ubuntu.com/ubuntu/ |
| Mike Marchetti | 13d76c8 | 2018-09-19 15:00:36 -0400 | [diff] [blame] | 119 | |
| 120 | # database |
| 121 | ENV OSMLCM_DATABASE_DRIVER mongo |
| Juan | cc084d7 | 2018-11-16 11:08:07 -0300 | [diff] [blame] | 122 | ENV OSMLCM_DATABASE_URI mongodb://mongo:27017 |
| 123 | #ENV OSMLCM_DATABASE_HOST mongo |
| 124 | #ENV OSMLCM_DATABASE_PORT 27017 |
| 125 | |
| 126 | |
| Mike Marchetti | 13d76c8 | 2018-09-19 15:00:36 -0400 | [diff] [blame] | 127 | ENV OSMLCM_STORAGE_DRIVER local |
| 128 | ENV OSMLCM_STORAGE_PATH /app/storage |
| 129 | |
| 130 | # message |
| 131 | ENV OSMLCM_MESSAGE_DRIVER kafka |
| 132 | ENV OSMLCM_MESSAGE_HOST kafka |
| 133 | ENV OSMLCM_MESSAGE_PORT 9092 |
| 134 | |
| garciadeblas | 0ccc31e | 2019-11-22 15:28:50 +0100 | [diff] [blame] | 135 | # k8s |
| 136 | ENV OSMLCM_VCA_HELMPATH /usr/local/bin/helm |
| 137 | ENV OSMLCM_VCA_KUBECTLPATH /usr/bin/kubectl |
| Adam Israel | 3f16fd5 | 2019-12-03 10:14:06 -0500 | [diff] [blame] | 138 | ENV OSMLCM_VCA_JUJUPATH /usr/local/bin/juju |
| garciadeblas | 0ccc31e | 2019-11-22 15:28:50 +0100 | [diff] [blame] | 139 | |
| 140 | # logs |
| 141 | # ENV OSMLCM_GLOBAL_LOGFILE /app/log/lcm.log |
| 142 | # ENV OSMLCM_GLOBAL_LOGLEVEL DEBUG |
| 143 | |
| tierno | 9f8b53b | 2019-09-13 13:19:48 +0000 | [diff] [blame] | 144 | HEALTHCHECK --start-period=120s --interval=30s --timeout=30s --retries=1 \ |
| tierno | 62478d1 | 2020-01-09 17:25:29 +0000 | [diff] [blame] | 145 | CMD python3 -m osm_lcm.lcm_hc || exit 1 |
| tierno | 84a3c9a | 2018-10-24 11:02:57 +0200 | [diff] [blame] | 146 | |
| 147 | |
| Mike Marchetti | 13d76c8 | 2018-09-19 15:00:36 -0400 | [diff] [blame] | 148 | # Run app.py when the container launches |
| tierno | 9f8b53b | 2019-09-13 13:19:48 +0000 | [diff] [blame] | 149 | CMD python3 -m osm_lcm.lcm |
| 150 | |