blob: 0038e78acbaa28558ef3184ba38ee8cb7b7ef843 [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
David Garciaa60ec732021-03-17 15:28:47 +010019FROM ubuntu:18.04 as INSTALL
Mike Marchetti13d76c82018-09-19 15:00:36 -040020
David Garciaa60ec732021-03-17 15:28:47 +010021RUN DEBIAN_FRONTEND=noninteractive apt-get --yes update && \
22 DEBIAN_FRONTEND=noninteractive apt-get --yes install \
23 gcc=4:7.4.0-1ubuntu2.3 \
24 python3=3.6.7-1~18.04 \
25 python3-dev=3.6.7-1~18.04 \
26 python3-setuptools=39.0.1-2 \
27 curl=7.58.0-2ubuntu3.13 && \
28 python3 -m easy_install pip==21.0.1
Mike Marchetti13d76c82018-09-19 15:00:36 -040029
David Garciaa60ec732021-03-17 15:28:47 +010030RUN DEBIAN_FRONTEND=noninteractive apt-get --yes install \
31 apt-transport-https=1.6.12ubuntu0.2 \
32 gnupg2=2.2.4-1ubuntu1.4
Mike Marchetti13d76c82018-09-19 15:00:36 -040033
David Garciaa60ec732021-03-17 15:28:47 +010034RUN curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add - \
garciadeblas0ccc31e2019-11-22 15:28:50 +010035 && echo "deb https://apt.kubernetes.io/ kubernetes-xenial main" | tee -a /etc/apt/sources.list.d/kubernetes.list \
David Garciaa60ec732021-03-17 15:28:47 +010036 && apt-get update && apt-get install -y kubectl=1.20.4-00
garciadeblas0ccc31e2019-11-22 15:28:50 +010037
38RUN curl https://get.helm.sh/helm-v2.15.2-linux-amd64.tar.gz --output helm-v2.15.2.tar.gz \
39 && tar -zxvf helm-v2.15.2.tar.gz \
40 && mv linux-amd64/helm /usr/local/bin/helm \
41 && rm -r linux-amd64/
42
lloretgalleg5926de22020-11-16 10:27:49 +000043RUN curl https://get.helm.sh/helm-v3.3.4-linux-amd64.tar.gz --output helm-v3.3.4.tar.gz \
44 && tar -zxvf helm-v3.3.4.tar.gz \
45 && mv linux-amd64/helm /usr/local/bin/helm3 \
46 && rm -r linux-amd64/
47
Dominik Fleischmann40e73bf2020-05-21 14:05:24 +020048RUN 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 \
49 && tar -xvf juju-2.7.6-k8s.tar.xz \
Adam Israel3f16fd52019-12-03 10:14:06 -050050 && mv juju /usr/local/bin/juju
51
Mike Marchetti13d76c82018-09-19 15:00:36 -040052
David Garciaa60ec732021-03-17 15:28:47 +010053ARG PYTHON3_OSM_COMMON_URL
54ARG PYTHON3_OSM_LCM_URL
55ARG PYTHON3_N2VC_URL
Mike Marchetti13d76c82018-09-19 15:00:36 -040056
David Garciaa60ec732021-03-17 15:28:47 +010057RUN curl $PYTHON3_OSM_COMMON_URL -o osm_common.deb
58RUN dpkg -i ./osm_common.deb
David Garcia5ac97812019-12-09 10:18:58 +010059
David Garciaa60ec732021-03-17 15:28:47 +010060RUN curl $PYTHON3_OSM_LCM_URL -o osm_lcm.deb
61RUN dpkg -i ./osm_lcm.deb
Mike Marchetti13d76c82018-09-19 15:00:36 -040062
David Garciaa60ec732021-03-17 15:28:47 +010063RUN curl $PYTHON3_N2VC_URL -o osm_n2vc.deb
64RUN dpkg -i ./osm_n2vc.deb
Mike Marchetti13d76c82018-09-19 15:00:36 -040065
David Garciaa60ec732021-03-17 15:28:47 +010066RUN pip3 install \
67 -r /usr/lib/python3/dist-packages/osm_common/requirements.txt \
68 -r /usr/lib/python3/dist-packages/osm_lcm/requirements.txt \
69 -r /usr/lib/python3/dist-packages/n2vc/requirements.txt
70
71FROM ubuntu:18.04
72
73RUN DEBIAN_FRONTEND=noninteractive apt-get --yes update && \
74 DEBIAN_FRONTEND=noninteractive apt-get --yes install python3-minimal=3.6.7-1~18.04
75
76COPY --from=INSTALL /usr/lib/python3/dist-packages /usr/lib/python3/dist-packages
77COPY --from=INSTALL /usr/local/lib/python3.6/dist-packages /usr/local/lib/python3.6/dist-packages
78
79COPY --from=INSTALL /usr/bin/kubectl /usr/bin/kubectl
80COPY --from=INSTALL /usr/local/bin/helm /usr/local/bin/helm
81COPY --from=INSTALL /usr/local/bin/helm3 /usr/local/bin/helm3
82COPY --from=INSTALL /usr/local/bin/juju /usr/local/bin/juju
83
84########################################################################
Mike Marchetti13d76c82018-09-19 15:00:36 -040085
86# Used for local storage
87VOLUME /app/storage
88# Used for logs
89VOLUME /app/log
90
91# The following ENV can be added with "docker run -e xxx' to configure LCM
92ENV OSMLCM_RO_HOST ro
93ENV OSMLCM_RO_PORT 9090
94ENV OSMLCM_RO_TENANT osm
95
96# VCA
97ENV OSMLCM_VCA_HOST vca
garciadeblasa2e41842019-12-18 11:05:24 +010098ENV OSMLCM_VCA_PORT 17070
99ENV OSMLCM_VCA_USER admin
100ENV OSMLCM_VCA_SECRET secret
101# ENV OSMLCM_VCA_PUBKEY pubkey
102# ENV OSMLCM_VCA_CACERT cacert
103# ENV OSMLCM_VCA_ENABLEOSUPGRADE false
104# ENV OSMLCM_VCA_APTMIRROR http://archive.ubuntu.com/ubuntu/
Mike Marchetti13d76c82018-09-19 15:00:36 -0400105
106# database
107ENV OSMLCM_DATABASE_DRIVER mongo
Juancc084d72018-11-16 11:08:07 -0300108ENV OSMLCM_DATABASE_URI mongodb://mongo:27017
109#ENV OSMLCM_DATABASE_HOST mongo
110#ENV OSMLCM_DATABASE_PORT 27017
111
112
Mike Marchetti13d76c82018-09-19 15:00:36 -0400113ENV OSMLCM_STORAGE_DRIVER local
114ENV OSMLCM_STORAGE_PATH /app/storage
115
116# message
117ENV OSMLCM_MESSAGE_DRIVER kafka
118ENV OSMLCM_MESSAGE_HOST kafka
119ENV OSMLCM_MESSAGE_PORT 9092
120
garciadeblas0ccc31e2019-11-22 15:28:50 +0100121# k8s
122ENV OSMLCM_VCA_HELMPATH /usr/local/bin/helm
123ENV OSMLCM_VCA_KUBECTLPATH /usr/bin/kubectl
Adam Israel3f16fd52019-12-03 10:14:06 -0500124ENV OSMLCM_VCA_JUJUPATH /usr/local/bin/juju
garciadeblas0ccc31e2019-11-22 15:28:50 +0100125
126# logs
127# ENV OSMLCM_GLOBAL_LOGFILE /app/log/lcm.log
128# ENV OSMLCM_GLOBAL_LOGLEVEL DEBUG
129
tierno9f8b53b2019-09-13 13:19:48 +0000130HEALTHCHECK --start-period=120s --interval=30s --timeout=30s --retries=1 \
tierno62478d12020-01-09 17:25:29 +0000131 CMD python3 -m osm_lcm.lcm_hc || exit 1
tierno84a3c9a2018-10-24 11:02:57 +0200132
133
Mike Marchetti13d76c82018-09-19 15:00:36 -0400134# Run app.py when the container launches
tierno9f8b53b2019-09-13 13:19:48 +0000135CMD python3 -m osm_lcm.lcm
136