blob: 15cf65ab9d0f7a7c211a7fa24e95ed281afc8de5 [file] [log] [blame]
beierlme7646252022-01-13 10:53:08 -05001#######################################################################################
2# Copyright ETSI Contributors and Others.
calvinosanchbfb77902019-07-31 13:31:16 +00003#
beierlme7646252022-01-13 10:53:08 -05004# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
calvinosanchbfb77902019-07-31 13:31:16 +00007#
beierlme7646252022-01-13 10:53:08 -05008# http://www.apache.org/licenses/LICENSE-2.0
calvinosanchbfb77902019-07-31 13:31:16 +00009#
10# Unless required by applicable law or agreed to in writing, software
beierlme7646252022-01-13 10:53:08 -050011# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
13# implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
16#######################################################################################
calvinosanchbfb77902019-07-31 13:31:16 +000017
David Garciaa60ec732021-03-17 15:28:47 +010018FROM ubuntu:18.04 as INSTALL
Mike Marchetti13d76c82018-09-19 15:00:36 -040019
beierlme7646252022-01-13 10:53:08 -050020ARG APT_PROXY
21RUN if [ ! -z $APT_PROXY ] ; then \
22 echo "Acquire::http::Proxy \"$APT_PROXY\";" > /etc/apt/apt.conf.d/proxy.conf ;\
23 echo "Acquire::https::Proxy \"$APT_PROXY\";" >> /etc/apt/apt.conf.d/proxy.conf ;\
24 fi
25
David Garciaa60ec732021-03-17 15:28:47 +010026RUN DEBIAN_FRONTEND=noninteractive apt-get --yes update && \
27 DEBIAN_FRONTEND=noninteractive apt-get --yes install \
sousaedufd164af2021-08-12 15:35:51 +010028 gcc=4:7.4.* \
29 python3=3.6.* \
30 python3-dev=3.6.* \
31 python3-setuptools=39.0.* \
32 curl=7.58.* \
33 apt-transport-https=1.6.* \
34 gnupg2=2.2.* \
35 openssh-client=1:7.* && \
sousaeducb992762021-08-31 18:52:26 +010036 python3 -m easy_install pip==21.0.1 setuptools==51.0.0
Mike Marchetti13d76c82018-09-19 15:00:36 -040037
garciadeblasf6f45842021-12-14 17:46:08 +010038# https://kubernetes.io/releases/
David Garciaa60ec732021-03-17 15:28:47 +010039RUN curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add - \
garciadeblas0ccc31e2019-11-22 15:28:50 +010040 && echo "deb https://apt.kubernetes.io/ kubernetes-xenial main" | tee -a /etc/apt/sources.list.d/kubernetes.list \
garciadeblasf6f45842021-12-14 17:46:08 +010041 && apt-get update && apt-get install -y kubectl=1.20.14-00
garciadeblas0ccc31e2019-11-22 15:28:50 +010042
David Garcia1d5c2212021-05-28 16:24:24 +020043RUN curl https://get.helm.sh/helm-v2.17.0-linux-amd64.tar.gz --output helm-v2.17.0.tar.gz \
44 && tar -zxvf helm-v2.17.0.tar.gz \
garciadeblas0ccc31e2019-11-22 15:28:50 +010045 && mv linux-amd64/helm /usr/local/bin/helm \
46 && rm -r linux-amd64/
47
garciadeblasf6f45842021-12-14 17:46:08 +010048# https://github.com/helm/helm/releases
49RUN curl https://get.helm.sh/helm-v3.7.2-linux-amd64.tar.gz --output helm-v3.7.2.tar.gz \
50 && tar -zxvf helm-v3.7.2.tar.gz \
lloretgalleg5926de22020-11-16 10:27:49 +000051 && mv linux-amd64/helm /usr/local/bin/helm3 \
52 && rm -r linux-amd64/
53
Mike Marchetti13d76c82018-09-19 15:00:36 -040054
David Garciaa60ec732021-03-17 15:28:47 +010055ARG PYTHON3_OSM_COMMON_URL
56ARG PYTHON3_OSM_LCM_URL
57ARG PYTHON3_N2VC_URL
Mike Marchetti13d76c82018-09-19 15:00:36 -040058
David Garciaa60ec732021-03-17 15:28:47 +010059RUN curl $PYTHON3_OSM_COMMON_URL -o osm_common.deb
60RUN dpkg -i ./osm_common.deb
David Garcia5ac97812019-12-09 10:18:58 +010061
David Garciaa60ec732021-03-17 15:28:47 +010062RUN curl $PYTHON3_OSM_LCM_URL -o osm_lcm.deb
63RUN dpkg -i ./osm_lcm.deb
Mike Marchetti13d76c82018-09-19 15:00:36 -040064
David Garciaa60ec732021-03-17 15:28:47 +010065RUN curl $PYTHON3_N2VC_URL -o osm_n2vc.deb
66RUN dpkg -i ./osm_n2vc.deb
Mike Marchetti13d76c82018-09-19 15:00:36 -040067
David Garciaa60ec732021-03-17 15:28:47 +010068RUN pip3 install \
69 -r /usr/lib/python3/dist-packages/osm_common/requirements.txt \
70 -r /usr/lib/python3/dist-packages/osm_lcm/requirements.txt \
71 -r /usr/lib/python3/dist-packages/n2vc/requirements.txt
72
73FROM ubuntu:18.04
74
75RUN DEBIAN_FRONTEND=noninteractive apt-get --yes update && \
garciadeblas15897d62021-09-22 18:11:54 +020076 DEBIAN_FRONTEND=noninteractive apt-get --yes install \
77 python3-minimal=3.6.* \
garciadeblas6ba74b52021-09-23 17:43:15 +020078 ca-certificates \
79 && rm -rf /var/lib/apt/lists/*
beierlm9c33b5a2021-04-13 10:04:22 -040080
David Garciaa60ec732021-03-17 15:28:47 +010081COPY --from=INSTALL /usr/lib/python3/dist-packages /usr/lib/python3/dist-packages
82COPY --from=INSTALL /usr/local/lib/python3.6/dist-packages /usr/local/lib/python3.6/dist-packages
83
84COPY --from=INSTALL /usr/bin/kubectl /usr/bin/kubectl
85COPY --from=INSTALL /usr/local/bin/helm /usr/local/bin/helm
86COPY --from=INSTALL /usr/local/bin/helm3 /usr/local/bin/helm3
beierlm3b36f4d2021-04-13 17:01:53 -040087COPY --from=INSTALL /usr/bin/scp /usr/bin/scp
beierlm249cd462021-04-07 14:19:03 -040088COPY --from=INSTALL /usr/bin/ssh-keygen /usr/bin/ssh-keygen
beierlm9c33b5a2021-04-13 10:04:22 -040089COPY --from=INSTALL /usr/bin/ssh /usr/bin/ssh
beierlm249cd462021-04-07 14:19:03 -040090COPY --from=INSTALL /usr/lib/x86_64-linux-gnu/ /usr/lib/x86_64-linux-gnu/
beierlm9c33b5a2021-04-13 10:04:22 -040091COPY --from=INSTALL /lib/x86_64-linux-gnu/ /lib/x86_64-linux-gnu/
David Garciaa60ec732021-03-17 15:28:47 +010092
sousaedu7389cfc2021-07-30 11:52:48 +020093COPY scripts/ scripts/
94
David Garciaa60ec732021-03-17 15:28:47 +010095########################################################################
Mike Marchetti13d76c82018-09-19 15:00:36 -040096
97# Used for local storage
98VOLUME /app/storage
99# Used for logs
100VOLUME /app/log
101
102# The following ENV can be added with "docker run -e xxx' to configure LCM
103ENV OSMLCM_RO_HOST ro
104ENV OSMLCM_RO_PORT 9090
105ENV OSMLCM_RO_TENANT osm
106
107# VCA
108ENV OSMLCM_VCA_HOST vca
garciadeblasa2e41842019-12-18 11:05:24 +0100109ENV OSMLCM_VCA_PORT 17070
110ENV OSMLCM_VCA_USER admin
111ENV OSMLCM_VCA_SECRET secret
112# ENV OSMLCM_VCA_PUBKEY pubkey
113# ENV OSMLCM_VCA_CACERT cacert
114# ENV OSMLCM_VCA_ENABLEOSUPGRADE false
115# ENV OSMLCM_VCA_APTMIRROR http://archive.ubuntu.com/ubuntu/
Mike Marchetti13d76c82018-09-19 15:00:36 -0400116
117# database
118ENV OSMLCM_DATABASE_DRIVER mongo
Juancc084d72018-11-16 11:08:07 -0300119ENV OSMLCM_DATABASE_URI mongodb://mongo:27017
120#ENV OSMLCM_DATABASE_HOST mongo
121#ENV OSMLCM_DATABASE_PORT 27017
122
123
Mike Marchetti13d76c82018-09-19 15:00:36 -0400124ENV OSMLCM_STORAGE_DRIVER local
125ENV OSMLCM_STORAGE_PATH /app/storage
126
127# message
128ENV OSMLCM_MESSAGE_DRIVER kafka
129ENV OSMLCM_MESSAGE_HOST kafka
130ENV OSMLCM_MESSAGE_PORT 9092
131
garciadeblas0ccc31e2019-11-22 15:28:50 +0100132# k8s
133ENV OSMLCM_VCA_HELMPATH /usr/local/bin/helm
134ENV OSMLCM_VCA_KUBECTLPATH /usr/bin/kubectl
Adam Israel3f16fd52019-12-03 10:14:06 -0500135ENV OSMLCM_VCA_JUJUPATH /usr/local/bin/juju
garciadeblas0ccc31e2019-11-22 15:28:50 +0100136
David Garcia1d5c2212021-05-28 16:24:24 +0200137# helm
138ENV OSMLCM_VCA_STABLEREPOURL https://charts.helm.sh/stable
sousaedu7389cfc2021-07-30 11:52:48 +0200139# ENV OSMLCM_VCA_HELM_CA_CERTS <ca-cert>
David Garcia1d5c2212021-05-28 16:24:24 +0200140
garciadeblas0ccc31e2019-11-22 15:28:50 +0100141# logs
142# ENV OSMLCM_GLOBAL_LOGFILE /app/log/lcm.log
143# ENV OSMLCM_GLOBAL_LOGLEVEL DEBUG
144
tierno9f8b53b2019-09-13 13:19:48 +0000145HEALTHCHECK --start-period=120s --interval=30s --timeout=30s --retries=1 \
tierno62478d12020-01-09 17:25:29 +0000146 CMD python3 -m osm_lcm.lcm_hc || exit 1
tierno84a3c9a2018-10-24 11:02:57 +0200147
148
Mike Marchetti13d76c82018-09-19 15:00:36 -0400149# Run app.py when the container launches
sousaedu7389cfc2021-07-30 11:52:48 +0200150CMD [ "/bin/bash", "scripts/start.sh" ]
tierno9f8b53b2019-09-13 13:19:48 +0000151