blob: 13443153262885fb9c8abc47e5a5afad569c2ee1 [file] [log] [blame]
Mark Beierl02ce9bf2023-02-21 19:37:58 +00001#######################################################################################
2# Copyright ETSI Contributors and Others.
3#
4# 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
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,
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#######################################################################################
17
Dario Faccin36faaff2023-05-23 17:44:49 +020018FROM ubuntu:22.04 as INSTALL
Mark Beierl02ce9bf2023-02-21 19:37:58 +000019
20ARG 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
26RUN DEBIAN_FRONTEND=noninteractive apt-get --yes update && \
27 DEBIAN_FRONTEND=noninteractive apt-get --yes install \
Dario Faccin36faaff2023-05-23 17:44:49 +020028 gcc=4:11.* \
29 python3=3.10.* \
30 python3-dev=3.10.* \
31 python3-pip=22.0.* \
32 curl=7.81.* \
33 && rm -rf /var/lib/apt/lists/*
34
35########### End of common prepration
Mark Beierl02ce9bf2023-02-21 19:37:58 +000036
37RUN DEBIAN_FRONTEND=noninteractive apt-get --yes update && \
38 DEBIAN_FRONTEND=noninteractive apt-get --yes install \
Dario Faccin36faaff2023-05-23 17:44:49 +020039 apt-transport-https=2.4.* \
Mark Beierl02ce9bf2023-02-21 19:37:58 +000040 gnupg2=2.2.* \
Dario Faccin36faaff2023-05-23 17:44:49 +020041 openssh-client=1:8.* \
42 && rm -rf /var/lib/apt/lists/*
Mark Beierl02ce9bf2023-02-21 19:37:58 +000043
44# https://kubernetes.io/releases/
45RUN curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add - \
46 && echo "deb https://apt.kubernetes.io/ kubernetes-xenial main" | tee -a /etc/apt/sources.list.d/kubernetes.list \
47 && apt-get update && apt-get install -y kubectl=1.23.3-00
48
49RUN curl https://get.helm.sh/helm-v2.17.0-linux-amd64.tar.gz --output helm-v2.17.0.tar.gz \
50 && tar -zxvf helm-v2.17.0.tar.gz \
51 && mv linux-amd64/helm /usr/local/bin/helm \
52 && rm -r linux-amd64/
53
54# https://github.com/helm/helm/releases
55RUN curl https://get.helm.sh/helm-v3.7.2-linux-amd64.tar.gz --output helm-v3.7.2.tar.gz \
56 && tar -zxvf helm-v3.7.2.tar.gz \
57 && mv linux-amd64/helm /usr/local/bin/helm3 \
58 && rm -r linux-amd64/
59
60ARG PYTHON3_OSM_COMMON_URL
61ARG PYTHON3_OSM_LCM_URL
62ARG PYTHON3_N2VC_URL
63
64RUN curl $PYTHON3_OSM_COMMON_URL -o osm_common.deb
65RUN dpkg -i ./osm_common.deb
66
67RUN curl $PYTHON3_OSM_LCM_URL -o osm_lcm.deb
68RUN dpkg -i ./osm_lcm.deb
69
70RUN curl $PYTHON3_N2VC_URL -o osm_n2vc.deb
71RUN dpkg -i ./osm_n2vc.deb
72
73RUN pip3 install \
74 -r /usr/lib/python3/dist-packages/osm_common/requirements.txt \
75 -r /usr/lib/python3/dist-packages/osm_lcm/requirements.txt \
76 -r /usr/lib/python3/dist-packages/n2vc/requirements.txt
77
78#######################################################################################
Dario Faccin36faaff2023-05-23 17:44:49 +020079FROM ubuntu:22.04 as FINAL
Mark Beierl02ce9bf2023-02-21 19:37:58 +000080
81ARG APT_PROXY
82RUN if [ ! -z $APT_PROXY ] ; then \
83 echo "Acquire::http::Proxy \"$APT_PROXY\";" > /etc/apt/apt.conf.d/proxy.conf ;\
84 echo "Acquire::https::Proxy \"$APT_PROXY\";" >> /etc/apt/apt.conf.d/proxy.conf ;\
85 fi
86
87RUN DEBIAN_FRONTEND=noninteractive apt-get --yes update && \
88 DEBIAN_FRONTEND=noninteractive apt-get --yes install \
Dario Faccin36faaff2023-05-23 17:44:49 +020089 python3-minimal=3.10.* \
Mark Beierl02ce9bf2023-02-21 19:37:58 +000090 && rm -rf /var/lib/apt/lists/*
91
Dario Faccin36faaff2023-05-23 17:44:49 +020092COPY --from=INSTALL /usr/lib/python3/dist-packages /usr/lib/python3/dist-packages
93COPY --from=INSTALL /usr/local/lib/python3.10/dist-packages /usr/local/lib/python3.10/dist-packages
94
95#######################################################################################
96# End of common prepration
97
Mark Beierl02ce9bf2023-02-21 19:37:58 +000098RUN DEBIAN_FRONTEND=noninteractive apt-get --yes update && \
99 DEBIAN_FRONTEND=noninteractive apt-get --yes install \
100 ca-certificates \
101 && rm -rf /var/lib/apt/lists/*
102
103RUN rm -f /etc/apt/apt.conf.d/proxy.conf
104
Mark Beierl02ce9bf2023-02-21 19:37:58 +0000105COPY --from=INSTALL /usr/bin/kubectl /usr/bin/kubectl
106COPY --from=INSTALL /usr/local/bin/helm /usr/local/bin/helm
107COPY --from=INSTALL /usr/local/bin/helm3 /usr/local/bin/helm3
108COPY --from=INSTALL /usr/bin/scp /usr/bin/scp
109COPY --from=INSTALL /usr/bin/ssh-keygen /usr/bin/ssh-keygen
110COPY --from=INSTALL /usr/bin/ssh /usr/bin/ssh
111COPY --from=INSTALL /usr/lib/x86_64-linux-gnu/ /usr/lib/x86_64-linux-gnu/
112COPY --from=INSTALL /lib/x86_64-linux-gnu/ /lib/x86_64-linux-gnu/
113
114COPY scripts/ /app/osm_lcm/scripts/
115
116# Creating the user for the app
117RUN groupadd -g 1000 appuser && \
118 useradd -u 1000 -g 1000 -d /app appuser && \
119 mkdir -p /app/osm_lcm && \
120 mkdir -p /app/storage/kafka && \
121 mkdir /app/log && \
122 chown -R appuser:appuser /app && \
123 chown appuser: /etc/ssl/certs/ca-certificates.crt
124
125
126WORKDIR /app/osm_lcm
127
128# Changing the security context
129USER appuser
130
131########################################################################
132
133# The following ENV can be added with "docker run -e xxx' to configure LCM
134ENV OSMLCM_RO_HOST ro
135ENV OSMLCM_RO_PORT 9090
136ENV OSMLCM_RO_TENANT osm
137
138# VCA
139ENV OSMLCM_VCA_HOST vca
140ENV OSMLCM_VCA_PORT 17070
141ENV OSMLCM_VCA_USER admin
142ENV OSMLCM_VCA_SECRET secret
143# ENV OSMLCM_VCA_PUBKEY pubkey
144# ENV OSMLCM_VCA_CACERT cacert
145# ENV OSMLCM_VCA_ENABLEOSUPGRADE false
146# ENV OSMLCM_VCA_APTMIRROR http://archive.ubuntu.com/ubuntu/
147
148# database
149ENV OSMLCM_DATABASE_DRIVER mongo
150ENV OSMLCM_DATABASE_URI mongodb://mongo:27017
151#ENV OSMLCM_DATABASE_HOST mongo
152#ENV OSMLCM_DATABASE_PORT 27017
153
154
155ENV OSMLCM_STORAGE_DRIVER local
156ENV OSMLCM_STORAGE_PATH /app/storage
157
158# message
159ENV OSMLCM_MESSAGE_DRIVER kafka
160ENV OSMLCM_MESSAGE_HOST kafka
161ENV OSMLCM_MESSAGE_PORT 9092
162
163# k8s
164ENV OSMLCM_VCA_HELMPATH /usr/local/bin/helm
165ENV OSMLCM_VCA_KUBECTLPATH /usr/bin/kubectl
166ENV OSMLCM_VCA_JUJUPATH /usr/local/bin/juju
167
168# helm
169ENV OSMLCM_VCA_STABLEREPOURL https://charts.helm.sh/stable
170# ENV OSMLCM_VCA_HELM_CA_CERTS <ca-cert>
171
172# logs
173# ENV OSMLCM_GLOBAL_LOGFILE /app/log/lcm.log
174# ENV OSMLCM_GLOBAL_LOGLEVEL DEBUG
175
176ENV OSMLCM_TEMPORAL_HOST temporal
177ENV OSMLCM_TEMPORAL_PORT 7233
178
179# Run app.py when the container launches
180CMD [ "/bin/bash", "scripts/nglcm.sh" ]