blob: 0c336d0c25150d973e365e6f40882e914ac67d6f [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 \
beierlm249cd462021-04-07 14:19:03 -040032 gnupg2=2.2.4-1ubuntu1.4 \
33 openssh-client
Mike Marchetti13d76c82018-09-19 15:00:36 -040034
David Garciaa60ec732021-03-17 15:28:47 +010035RUN curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add - \
garciadeblas0ccc31e2019-11-22 15:28:50 +010036 && 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 +010037 && apt-get update && apt-get install -y kubectl=1.20.4-00
garciadeblas0ccc31e2019-11-22 15:28:50 +010038
39RUN curl https://get.helm.sh/helm-v2.15.2-linux-amd64.tar.gz --output helm-v2.15.2.tar.gz \
40 && tar -zxvf helm-v2.15.2.tar.gz \
41 && mv linux-amd64/helm /usr/local/bin/helm \
42 && rm -r linux-amd64/
43
lloretgalleg5926de22020-11-16 10:27:49 +000044RUN curl https://get.helm.sh/helm-v3.3.4-linux-amd64.tar.gz --output helm-v3.3.4.tar.gz \
45 && tar -zxvf helm-v3.3.4.tar.gz \
46 && mv linux-amd64/helm /usr/local/bin/helm3 \
47 && rm -r linux-amd64/
48
Dominik Fleischmann40e73bf2020-05-21 14:05:24 +020049RUN 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 \
50 && tar -xvf juju-2.7.6-k8s.tar.xz \
Adam Israel3f16fd52019-12-03 10:14:06 -050051 && mv juju /usr/local/bin/juju
52
Mike Marchetti13d76c82018-09-19 15:00:36 -040053
David Garciaa60ec732021-03-17 15:28:47 +010054ARG PYTHON3_OSM_COMMON_URL
55ARG PYTHON3_OSM_LCM_URL
56ARG PYTHON3_N2VC_URL
Mike Marchetti13d76c82018-09-19 15:00:36 -040057
David Garciaa60ec732021-03-17 15:28:47 +010058RUN curl $PYTHON3_OSM_COMMON_URL -o osm_common.deb
59RUN dpkg -i ./osm_common.deb
David Garcia5ac97812019-12-09 10:18:58 +010060
David Garciaa60ec732021-03-17 15:28:47 +010061RUN curl $PYTHON3_OSM_LCM_URL -o osm_lcm.deb
62RUN dpkg -i ./osm_lcm.deb
Mike Marchetti13d76c82018-09-19 15:00:36 -040063
David Garciaa60ec732021-03-17 15:28:47 +010064RUN curl $PYTHON3_N2VC_URL -o osm_n2vc.deb
65RUN dpkg -i ./osm_n2vc.deb
Mike Marchetti13d76c82018-09-19 15:00:36 -040066
David Garciaa60ec732021-03-17 15:28:47 +010067RUN pip3 install \
68 -r /usr/lib/python3/dist-packages/osm_common/requirements.txt \
69 -r /usr/lib/python3/dist-packages/osm_lcm/requirements.txt \
70 -r /usr/lib/python3/dist-packages/n2vc/requirements.txt
71
72FROM ubuntu:18.04
73
74RUN DEBIAN_FRONTEND=noninteractive apt-get --yes update && \
75 DEBIAN_FRONTEND=noninteractive apt-get --yes install python3-minimal=3.6.7-1~18.04
76
77COPY --from=INSTALL /usr/lib/python3/dist-packages /usr/lib/python3/dist-packages
78COPY --from=INSTALL /usr/local/lib/python3.6/dist-packages /usr/local/lib/python3.6/dist-packages
79
80COPY --from=INSTALL /usr/bin/kubectl /usr/bin/kubectl
81COPY --from=INSTALL /usr/local/bin/helm /usr/local/bin/helm
82COPY --from=INSTALL /usr/local/bin/helm3 /usr/local/bin/helm3
83COPY --from=INSTALL /usr/local/bin/juju /usr/local/bin/juju
beierlm249cd462021-04-07 14:19:03 -040084COPY --from=INSTALL /usr/bin/ssh-keygen /usr/bin/ssh-keygen
85COPY --from=INSTALL /usr/lib/x86_64-linux-gnu/ /usr/lib/x86_64-linux-gnu/
David Garciaa60ec732021-03-17 15:28:47 +010086
87########################################################################
Mike Marchetti13d76c82018-09-19 15:00:36 -040088
89# Used for local storage
90VOLUME /app/storage
91# Used for logs
92VOLUME /app/log
93
94# The following ENV can be added with "docker run -e xxx' to configure LCM
95ENV OSMLCM_RO_HOST ro
96ENV OSMLCM_RO_PORT 9090
97ENV OSMLCM_RO_TENANT osm
98
99# VCA
100ENV OSMLCM_VCA_HOST vca
garciadeblasa2e41842019-12-18 11:05:24 +0100101ENV OSMLCM_VCA_PORT 17070
102ENV OSMLCM_VCA_USER admin
103ENV OSMLCM_VCA_SECRET secret
104# ENV OSMLCM_VCA_PUBKEY pubkey
105# ENV OSMLCM_VCA_CACERT cacert
106# ENV OSMLCM_VCA_ENABLEOSUPGRADE false
107# ENV OSMLCM_VCA_APTMIRROR http://archive.ubuntu.com/ubuntu/
Mike Marchetti13d76c82018-09-19 15:00:36 -0400108
109# database
110ENV OSMLCM_DATABASE_DRIVER mongo
Juancc084d72018-11-16 11:08:07 -0300111ENV OSMLCM_DATABASE_URI mongodb://mongo:27017
112#ENV OSMLCM_DATABASE_HOST mongo
113#ENV OSMLCM_DATABASE_PORT 27017
114
115
Mike Marchetti13d76c82018-09-19 15:00:36 -0400116ENV OSMLCM_STORAGE_DRIVER local
117ENV OSMLCM_STORAGE_PATH /app/storage
118
119# message
120ENV OSMLCM_MESSAGE_DRIVER kafka
121ENV OSMLCM_MESSAGE_HOST kafka
122ENV OSMLCM_MESSAGE_PORT 9092
123
garciadeblas0ccc31e2019-11-22 15:28:50 +0100124# k8s
125ENV OSMLCM_VCA_HELMPATH /usr/local/bin/helm
126ENV OSMLCM_VCA_KUBECTLPATH /usr/bin/kubectl
Adam Israel3f16fd52019-12-03 10:14:06 -0500127ENV OSMLCM_VCA_JUJUPATH /usr/local/bin/juju
garciadeblas0ccc31e2019-11-22 15:28:50 +0100128
129# logs
130# ENV OSMLCM_GLOBAL_LOGFILE /app/log/lcm.log
131# ENV OSMLCM_GLOBAL_LOGLEVEL DEBUG
132
tierno9f8b53b2019-09-13 13:19:48 +0000133HEALTHCHECK --start-period=120s --interval=30s --timeout=30s --retries=1 \
tierno62478d12020-01-09 17:25:29 +0000134 CMD python3 -m osm_lcm.lcm_hc || exit 1
tierno84a3c9a2018-10-24 11:02:57 +0200135
136
Mike Marchetti13d76c82018-09-19 15:00:36 -0400137# Run app.py when the container launches
tierno9f8b53b2019-09-13 13:19:48 +0000138CMD python3 -m osm_lcm.lcm
139