blob: ef178e126424c7259a0b92db756ed8c643ce7620 [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
beierlmd7449362022-01-13 10:53:08 -050018FROM ubuntu:20.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 \
beierlmd7449362022-01-13 10:53:08 -050028 gcc=4:9.3.* \
29 python3=3.8.* \
30 python3-dev=3.8.* \
31 python3-pip=20.0.2* \
32 python3-setuptools=45.2.* \
33 curl=7.68.*
34
35RUN DEBIAN_FRONTEND=noninteractive apt-get --yes install \
36 apt-transport-https=2.0.* \
sousaedufd164af2021-08-12 15:35:51 +010037 gnupg2=2.2.* \
beierlmd7449362022-01-13 10:53:08 -050038 openssh-client=1:8.*
Mike Marchetti13d76c82018-09-19 15:00:36 -040039
garciadeblasf6f45842021-12-14 17:46:08 +010040# https://kubernetes.io/releases/
David Garciaa60ec732021-03-17 15:28:47 +010041RUN curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add - \
garciadeblas0ccc31e2019-11-22 15:28:50 +010042 && echo "deb https://apt.kubernetes.io/ kubernetes-xenial main" | tee -a /etc/apt/sources.list.d/kubernetes.list \
garciadeblasf6f45842021-12-14 17:46:08 +010043 && apt-get update && apt-get install -y kubectl=1.20.14-00
garciadeblas0ccc31e2019-11-22 15:28:50 +010044
David Garcia1d5c2212021-05-28 16:24:24 +020045RUN curl https://get.helm.sh/helm-v2.17.0-linux-amd64.tar.gz --output helm-v2.17.0.tar.gz \
46 && tar -zxvf helm-v2.17.0.tar.gz \
garciadeblas0ccc31e2019-11-22 15:28:50 +010047 && mv linux-amd64/helm /usr/local/bin/helm \
48 && rm -r linux-amd64/
49
garciadeblasf6f45842021-12-14 17:46:08 +010050# https://github.com/helm/helm/releases
51RUN curl https://get.helm.sh/helm-v3.7.2-linux-amd64.tar.gz --output helm-v3.7.2.tar.gz \
52 && tar -zxvf helm-v3.7.2.tar.gz \
lloretgalleg5926de22020-11-16 10:27:49 +000053 && mv linux-amd64/helm /usr/local/bin/helm3 \
54 && rm -r linux-amd64/
55
Mike Marchetti13d76c82018-09-19 15:00:36 -040056
David Garciaa60ec732021-03-17 15:28:47 +010057ARG PYTHON3_OSM_COMMON_URL
58ARG PYTHON3_OSM_LCM_URL
59ARG PYTHON3_N2VC_URL
Mike Marchetti13d76c82018-09-19 15:00:36 -040060
David Garciaa60ec732021-03-17 15:28:47 +010061RUN curl $PYTHON3_OSM_COMMON_URL -o osm_common.deb
62RUN dpkg -i ./osm_common.deb
David Garcia5ac97812019-12-09 10:18:58 +010063
David Garciaa60ec732021-03-17 15:28:47 +010064RUN curl $PYTHON3_OSM_LCM_URL -o osm_lcm.deb
65RUN dpkg -i ./osm_lcm.deb
Mike Marchetti13d76c82018-09-19 15:00:36 -040066
David Garciaa60ec732021-03-17 15:28:47 +010067RUN curl $PYTHON3_N2VC_URL -o osm_n2vc.deb
68RUN dpkg -i ./osm_n2vc.deb
Mike Marchetti13d76c82018-09-19 15:00:36 -040069
David Garciaa60ec732021-03-17 15:28:47 +010070RUN pip3 install \
71 -r /usr/lib/python3/dist-packages/osm_common/requirements.txt \
72 -r /usr/lib/python3/dist-packages/osm_lcm/requirements.txt \
73 -r /usr/lib/python3/dist-packages/n2vc/requirements.txt
74
beierlmd7449362022-01-13 10:53:08 -050075#######################################################################################
76FROM ubuntu:20.04 as FINAL
77
78ARG APT_PROXY
79RUN if [ ! -z $APT_PROXY ] ; then \
80 echo "Acquire::http::Proxy \"$APT_PROXY\";" > /etc/apt/apt.conf.d/proxy.conf ;\
81 echo "Acquire::https::Proxy \"$APT_PROXY\";" >> /etc/apt/apt.conf.d/proxy.conf ;\
82 fi
David Garciaa60ec732021-03-17 15:28:47 +010083
84RUN DEBIAN_FRONTEND=noninteractive apt-get --yes update && \
garciadeblas15897d62021-09-22 18:11:54 +020085 DEBIAN_FRONTEND=noninteractive apt-get --yes install \
beierlmd7449362022-01-13 10:53:08 -050086 python3-minimal=3.8.* \
87 && rm -rf /var/lib/apt/lists/*
88
89RUN DEBIAN_FRONTEND=noninteractive apt-get --yes update && \
90 DEBIAN_FRONTEND=noninteractive apt-get --yes install \
garciadeblas6ba74b52021-09-23 17:43:15 +020091 ca-certificates \
92 && rm -rf /var/lib/apt/lists/*
beierlm9c33b5a2021-04-13 10:04:22 -040093
David Garciaa60ec732021-03-17 15:28:47 +010094COPY --from=INSTALL /usr/lib/python3/dist-packages /usr/lib/python3/dist-packages
beierlmd7449362022-01-13 10:53:08 -050095COPY --from=INSTALL /usr/local/lib/python3.8/dist-packages /usr/local/lib/python3.8/dist-packages
David Garciaa60ec732021-03-17 15:28:47 +010096
97COPY --from=INSTALL /usr/bin/kubectl /usr/bin/kubectl
98COPY --from=INSTALL /usr/local/bin/helm /usr/local/bin/helm
99COPY --from=INSTALL /usr/local/bin/helm3 /usr/local/bin/helm3
beierlm3b36f4d2021-04-13 17:01:53 -0400100COPY --from=INSTALL /usr/bin/scp /usr/bin/scp
beierlm249cd462021-04-07 14:19:03 -0400101COPY --from=INSTALL /usr/bin/ssh-keygen /usr/bin/ssh-keygen
beierlm9c33b5a2021-04-13 10:04:22 -0400102COPY --from=INSTALL /usr/bin/ssh /usr/bin/ssh
beierlm249cd462021-04-07 14:19:03 -0400103COPY --from=INSTALL /usr/lib/x86_64-linux-gnu/ /usr/lib/x86_64-linux-gnu/
beierlm9c33b5a2021-04-13 10:04:22 -0400104COPY --from=INSTALL /lib/x86_64-linux-gnu/ /lib/x86_64-linux-gnu/
David Garciaa60ec732021-03-17 15:28:47 +0100105
sousaedu7389cfc2021-07-30 11:52:48 +0200106COPY scripts/ scripts/
107
David Garciaa60ec732021-03-17 15:28:47 +0100108########################################################################
Mike Marchetti13d76c82018-09-19 15:00:36 -0400109
110# Used for local storage
111VOLUME /app/storage
112# Used for logs
113VOLUME /app/log
114
115# The following ENV can be added with "docker run -e xxx' to configure LCM
116ENV OSMLCM_RO_HOST ro
117ENV OSMLCM_RO_PORT 9090
118ENV OSMLCM_RO_TENANT osm
119
120# VCA
121ENV OSMLCM_VCA_HOST vca
garciadeblasa2e41842019-12-18 11:05:24 +0100122ENV OSMLCM_VCA_PORT 17070
123ENV OSMLCM_VCA_USER admin
124ENV OSMLCM_VCA_SECRET secret
125# ENV OSMLCM_VCA_PUBKEY pubkey
126# ENV OSMLCM_VCA_CACERT cacert
127# ENV OSMLCM_VCA_ENABLEOSUPGRADE false
128# ENV OSMLCM_VCA_APTMIRROR http://archive.ubuntu.com/ubuntu/
Mike Marchetti13d76c82018-09-19 15:00:36 -0400129
130# database
131ENV OSMLCM_DATABASE_DRIVER mongo
Juancc084d72018-11-16 11:08:07 -0300132ENV OSMLCM_DATABASE_URI mongodb://mongo:27017
133#ENV OSMLCM_DATABASE_HOST mongo
134#ENV OSMLCM_DATABASE_PORT 27017
135
136
Mike Marchetti13d76c82018-09-19 15:00:36 -0400137ENV OSMLCM_STORAGE_DRIVER local
138ENV OSMLCM_STORAGE_PATH /app/storage
139
140# message
141ENV OSMLCM_MESSAGE_DRIVER kafka
142ENV OSMLCM_MESSAGE_HOST kafka
143ENV OSMLCM_MESSAGE_PORT 9092
144
garciadeblas0ccc31e2019-11-22 15:28:50 +0100145# k8s
146ENV OSMLCM_VCA_HELMPATH /usr/local/bin/helm
147ENV OSMLCM_VCA_KUBECTLPATH /usr/bin/kubectl
Adam Israel3f16fd52019-12-03 10:14:06 -0500148ENV OSMLCM_VCA_JUJUPATH /usr/local/bin/juju
garciadeblas0ccc31e2019-11-22 15:28:50 +0100149
David Garcia1d5c2212021-05-28 16:24:24 +0200150# helm
151ENV OSMLCM_VCA_STABLEREPOURL https://charts.helm.sh/stable
sousaedu7389cfc2021-07-30 11:52:48 +0200152# ENV OSMLCM_VCA_HELM_CA_CERTS <ca-cert>
David Garcia1d5c2212021-05-28 16:24:24 +0200153
garciadeblas0ccc31e2019-11-22 15:28:50 +0100154# logs
155# ENV OSMLCM_GLOBAL_LOGFILE /app/log/lcm.log
156# ENV OSMLCM_GLOBAL_LOGLEVEL DEBUG
157
tierno9f8b53b2019-09-13 13:19:48 +0000158HEALTHCHECK --start-period=120s --interval=30s --timeout=30s --retries=1 \
tierno62478d12020-01-09 17:25:29 +0000159 CMD python3 -m osm_lcm.lcm_hc || exit 1
tierno84a3c9a2018-10-24 11:02:57 +0200160
161
Mike Marchetti13d76c82018-09-19 15:00:36 -0400162# Run app.py when the container launches
sousaedu7389cfc2021-07-30 11:52:48 +0200163CMD [ "/bin/bash", "scripts/start.sh" ]
tierno9f8b53b2019-09-13 13:19:48 +0000164