blob: 7a5e376812e09b3754f8bb30d57305276e4276f6 [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 \
sousaedufd164af2021-08-12 15:35:51 +010023 gcc=4:7.4.* \
24 python3=3.6.* \
25 python3-dev=3.6.* \
26 python3-setuptools=39.0.* \
27 curl=7.58.* \
28 apt-transport-https=1.6.* \
29 gnupg2=2.2.* \
30 openssh-client=1:7.* && \
sousaeducb992762021-08-31 18:52:26 +010031 python3 -m easy_install pip==21.0.1 setuptools==51.0.0
Mike Marchetti13d76c82018-09-19 15:00:36 -040032
David Garciaa60ec732021-03-17 15:28:47 +010033RUN curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add - \
garciadeblas0ccc31e2019-11-22 15:28:50 +010034 && 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 +010035 && apt-get update && apt-get install -y kubectl=1.20.4-00
garciadeblas0ccc31e2019-11-22 15:28:50 +010036
David Garcia1d5c2212021-05-28 16:24:24 +020037RUN curl https://get.helm.sh/helm-v2.17.0-linux-amd64.tar.gz --output helm-v2.17.0.tar.gz \
38 && tar -zxvf helm-v2.17.0.tar.gz \
garciadeblas0ccc31e2019-11-22 15:28:50 +010039 && mv linux-amd64/helm /usr/local/bin/helm \
40 && rm -r linux-amd64/
41
lloretgalleg5926de22020-11-16 10:27:49 +000042RUN curl https://get.helm.sh/helm-v3.3.4-linux-amd64.tar.gz --output helm-v3.3.4.tar.gz \
43 && tar -zxvf helm-v3.3.4.tar.gz \
44 && mv linux-amd64/helm /usr/local/bin/helm3 \
45 && rm -r linux-amd64/
46
Mike Marchetti13d76c82018-09-19 15:00:36 -040047
David Garciaa60ec732021-03-17 15:28:47 +010048ARG PYTHON3_OSM_COMMON_URL
49ARG PYTHON3_OSM_LCM_URL
50ARG PYTHON3_N2VC_URL
Mike Marchetti13d76c82018-09-19 15:00:36 -040051
David Garciaa60ec732021-03-17 15:28:47 +010052RUN curl $PYTHON3_OSM_COMMON_URL -o osm_common.deb
53RUN dpkg -i ./osm_common.deb
David Garcia5ac97812019-12-09 10:18:58 +010054
David Garciaa60ec732021-03-17 15:28:47 +010055RUN curl $PYTHON3_OSM_LCM_URL -o osm_lcm.deb
56RUN dpkg -i ./osm_lcm.deb
Mike Marchetti13d76c82018-09-19 15:00:36 -040057
David Garciaa60ec732021-03-17 15:28:47 +010058RUN curl $PYTHON3_N2VC_URL -o osm_n2vc.deb
59RUN dpkg -i ./osm_n2vc.deb
Mike Marchetti13d76c82018-09-19 15:00:36 -040060
David Garciaa60ec732021-03-17 15:28:47 +010061RUN pip3 install \
62 -r /usr/lib/python3/dist-packages/osm_common/requirements.txt \
63 -r /usr/lib/python3/dist-packages/osm_lcm/requirements.txt \
64 -r /usr/lib/python3/dist-packages/n2vc/requirements.txt
65
66FROM ubuntu:18.04
67
68RUN DEBIAN_FRONTEND=noninteractive apt-get --yes update && \
garciadeblas15897d62021-09-22 18:11:54 +020069 DEBIAN_FRONTEND=noninteractive apt-get --yes install \
70 python3-minimal=3.6.* \
garciadeblas6ba74b52021-09-23 17:43:15 +020071 ca-certificates \
72 && rm -rf /var/lib/apt/lists/*
beierlm9c33b5a2021-04-13 10:04:22 -040073
David Garciaa60ec732021-03-17 15:28:47 +010074COPY --from=INSTALL /usr/lib/python3/dist-packages /usr/lib/python3/dist-packages
75COPY --from=INSTALL /usr/local/lib/python3.6/dist-packages /usr/local/lib/python3.6/dist-packages
76
77COPY --from=INSTALL /usr/bin/kubectl /usr/bin/kubectl
78COPY --from=INSTALL /usr/local/bin/helm /usr/local/bin/helm
79COPY --from=INSTALL /usr/local/bin/helm3 /usr/local/bin/helm3
beierlm3b36f4d2021-04-13 17:01:53 -040080COPY --from=INSTALL /usr/bin/scp /usr/bin/scp
beierlm249cd462021-04-07 14:19:03 -040081COPY --from=INSTALL /usr/bin/ssh-keygen /usr/bin/ssh-keygen
beierlm9c33b5a2021-04-13 10:04:22 -040082COPY --from=INSTALL /usr/bin/ssh /usr/bin/ssh
beierlm249cd462021-04-07 14:19:03 -040083COPY --from=INSTALL /usr/lib/x86_64-linux-gnu/ /usr/lib/x86_64-linux-gnu/
beierlm9c33b5a2021-04-13 10:04:22 -040084COPY --from=INSTALL /lib/x86_64-linux-gnu/ /lib/x86_64-linux-gnu/
David Garciaa60ec732021-03-17 15:28:47 +010085
sousaedu7389cfc2021-07-30 11:52:48 +020086COPY scripts/ scripts/
87
David Garciaa60ec732021-03-17 15:28:47 +010088########################################################################
Mike Marchetti13d76c82018-09-19 15:00:36 -040089
90# Used for local storage
91VOLUME /app/storage
92# Used for logs
93VOLUME /app/log
94
95# The following ENV can be added with "docker run -e xxx' to configure LCM
96ENV OSMLCM_RO_HOST ro
97ENV OSMLCM_RO_PORT 9090
98ENV OSMLCM_RO_TENANT osm
99
100# VCA
101ENV OSMLCM_VCA_HOST vca
garciadeblasa2e41842019-12-18 11:05:24 +0100102ENV OSMLCM_VCA_PORT 17070
103ENV OSMLCM_VCA_USER admin
104ENV OSMLCM_VCA_SECRET secret
105# ENV OSMLCM_VCA_PUBKEY pubkey
106# ENV OSMLCM_VCA_CACERT cacert
107# ENV OSMLCM_VCA_ENABLEOSUPGRADE false
108# ENV OSMLCM_VCA_APTMIRROR http://archive.ubuntu.com/ubuntu/
Mike Marchetti13d76c82018-09-19 15:00:36 -0400109
110# database
111ENV OSMLCM_DATABASE_DRIVER mongo
Juancc084d72018-11-16 11:08:07 -0300112ENV OSMLCM_DATABASE_URI mongodb://mongo:27017
113#ENV OSMLCM_DATABASE_HOST mongo
114#ENV OSMLCM_DATABASE_PORT 27017
115
116
Mike Marchetti13d76c82018-09-19 15:00:36 -0400117ENV OSMLCM_STORAGE_DRIVER local
118ENV OSMLCM_STORAGE_PATH /app/storage
119
120# message
121ENV OSMLCM_MESSAGE_DRIVER kafka
122ENV OSMLCM_MESSAGE_HOST kafka
123ENV OSMLCM_MESSAGE_PORT 9092
124
garciadeblas0ccc31e2019-11-22 15:28:50 +0100125# k8s
126ENV OSMLCM_VCA_HELMPATH /usr/local/bin/helm
127ENV OSMLCM_VCA_KUBECTLPATH /usr/bin/kubectl
Adam Israel3f16fd52019-12-03 10:14:06 -0500128ENV OSMLCM_VCA_JUJUPATH /usr/local/bin/juju
garciadeblas0ccc31e2019-11-22 15:28:50 +0100129
David Garcia1d5c2212021-05-28 16:24:24 +0200130# helm
131ENV OSMLCM_VCA_STABLEREPOURL https://charts.helm.sh/stable
sousaedu7389cfc2021-07-30 11:52:48 +0200132# ENV OSMLCM_VCA_HELM_CA_CERTS <ca-cert>
David Garcia1d5c2212021-05-28 16:24:24 +0200133
garciadeblas0ccc31e2019-11-22 15:28:50 +0100134# logs
135# ENV OSMLCM_GLOBAL_LOGFILE /app/log/lcm.log
136# ENV OSMLCM_GLOBAL_LOGLEVEL DEBUG
137
tierno9f8b53b2019-09-13 13:19:48 +0000138HEALTHCHECK --start-period=120s --interval=30s --timeout=30s --retries=1 \
tierno62478d12020-01-09 17:25:29 +0000139 CMD python3 -m osm_lcm.lcm_hc || exit 1
tierno84a3c9a2018-10-24 11:02:57 +0200140
141
Mike Marchetti13d76c82018-09-19 15:00:36 -0400142# Run app.py when the container launches
sousaedu7389cfc2021-07-30 11:52:48 +0200143CMD [ "/bin/bash", "scripts/start.sh" ]
tierno9f8b53b2019-09-13 13:19:48 +0000144