blob: 9ededf5bb2244a1322d25032c74f7a2952793cda [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
18FROM ubuntu:20.04 as INSTALL
19
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 \
28 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 update && \
36 DEBIAN_FRONTEND=noninteractive apt-get --yes install \
37 apt-transport-https=2.0.* \
38 gnupg2=2.2.* \
39 openssh-client=1:8.*
40
41# https://kubernetes.io/releases/
42RUN curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add - \
43 && echo "deb https://apt.kubernetes.io/ kubernetes-xenial main" | tee -a /etc/apt/sources.list.d/kubernetes.list \
44 && apt-get update && apt-get install -y kubectl=1.23.3-00
45
46RUN curl https://get.helm.sh/helm-v2.17.0-linux-amd64.tar.gz --output helm-v2.17.0.tar.gz \
47 && tar -zxvf helm-v2.17.0.tar.gz \
48 && mv linux-amd64/helm /usr/local/bin/helm \
49 && rm -r linux-amd64/
50
51# https://github.com/helm/helm/releases
52RUN curl https://get.helm.sh/helm-v3.7.2-linux-amd64.tar.gz --output helm-v3.7.2.tar.gz \
53 && tar -zxvf helm-v3.7.2.tar.gz \
54 && mv linux-amd64/helm /usr/local/bin/helm3 \
55 && rm -r linux-amd64/
56
57ARG PYTHON3_OSM_COMMON_URL
58ARG PYTHON3_OSM_LCM_URL
59ARG PYTHON3_N2VC_URL
60
61RUN curl $PYTHON3_OSM_COMMON_URL -o osm_common.deb
62RUN dpkg -i ./osm_common.deb
63
64RUN curl $PYTHON3_OSM_LCM_URL -o osm_lcm.deb
65RUN dpkg -i ./osm_lcm.deb
66
67RUN curl $PYTHON3_N2VC_URL -o osm_n2vc.deb
68RUN dpkg -i ./osm_n2vc.deb
69
70RUN 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
75#######################################################################################
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
83
84RUN DEBIAN_FRONTEND=noninteractive apt-get --yes update && \
85 DEBIAN_FRONTEND=noninteractive apt-get --yes install \
86 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 \
91 ca-certificates \
92 && rm -rf /var/lib/apt/lists/*
93
94RUN rm -f /etc/apt/apt.conf.d/proxy.conf
95
96COPY --from=INSTALL /usr/lib/python3/dist-packages /usr/lib/python3/dist-packages
97COPY --from=INSTALL /usr/local/lib/python3.8/dist-packages /usr/local/lib/python3.8/dist-packages
98
99COPY --from=INSTALL /usr/bin/kubectl /usr/bin/kubectl
100COPY --from=INSTALL /usr/local/bin/helm /usr/local/bin/helm
101COPY --from=INSTALL /usr/local/bin/helm3 /usr/local/bin/helm3
102COPY --from=INSTALL /usr/bin/scp /usr/bin/scp
103COPY --from=INSTALL /usr/bin/ssh-keygen /usr/bin/ssh-keygen
104COPY --from=INSTALL /usr/bin/ssh /usr/bin/ssh
105COPY --from=INSTALL /usr/lib/x86_64-linux-gnu/ /usr/lib/x86_64-linux-gnu/
106COPY --from=INSTALL /lib/x86_64-linux-gnu/ /lib/x86_64-linux-gnu/
107
108COPY scripts/ /app/osm_lcm/scripts/
109
110# Creating the user for the app
111RUN groupadd -g 1000 appuser && \
112 useradd -u 1000 -g 1000 -d /app appuser && \
113 mkdir -p /app/osm_lcm && \
114 mkdir -p /app/storage/kafka && \
115 mkdir /app/log && \
116 chown -R appuser:appuser /app && \
117 chown appuser: /etc/ssl/certs/ca-certificates.crt
118
119
120WORKDIR /app/osm_lcm
121
122# Changing the security context
123USER appuser
124
125########################################################################
126
127# The following ENV can be added with "docker run -e xxx' to configure LCM
128ENV OSMLCM_RO_HOST ro
129ENV OSMLCM_RO_PORT 9090
130ENV OSMLCM_RO_TENANT osm
131
132# VCA
133ENV OSMLCM_VCA_HOST vca
134ENV OSMLCM_VCA_PORT 17070
135ENV OSMLCM_VCA_USER admin
136ENV OSMLCM_VCA_SECRET secret
137# ENV OSMLCM_VCA_PUBKEY pubkey
138# ENV OSMLCM_VCA_CACERT cacert
139# ENV OSMLCM_VCA_ENABLEOSUPGRADE false
140# ENV OSMLCM_VCA_APTMIRROR http://archive.ubuntu.com/ubuntu/
141
142# database
143ENV OSMLCM_DATABASE_DRIVER mongo
144ENV OSMLCM_DATABASE_URI mongodb://mongo:27017
145#ENV OSMLCM_DATABASE_HOST mongo
146#ENV OSMLCM_DATABASE_PORT 27017
147
148
149ENV OSMLCM_STORAGE_DRIVER local
150ENV OSMLCM_STORAGE_PATH /app/storage
151
152# message
153ENV OSMLCM_MESSAGE_DRIVER kafka
154ENV OSMLCM_MESSAGE_HOST kafka
155ENV OSMLCM_MESSAGE_PORT 9092
156
157# k8s
158ENV OSMLCM_VCA_HELMPATH /usr/local/bin/helm
159ENV OSMLCM_VCA_KUBECTLPATH /usr/bin/kubectl
160ENV OSMLCM_VCA_JUJUPATH /usr/local/bin/juju
161
162# helm
163ENV OSMLCM_VCA_STABLEREPOURL https://charts.helm.sh/stable
164# ENV OSMLCM_VCA_HELM_CA_CERTS <ca-cert>
165
166# logs
167# ENV OSMLCM_GLOBAL_LOGFILE /app/log/lcm.log
168# ENV OSMLCM_GLOBAL_LOGLEVEL DEBUG
169
170ENV OSMLCM_TEMPORAL_HOST temporal
171ENV OSMLCM_TEMPORAL_PORT 7233
172
173# Run app.py when the container launches
174CMD [ "/bin/bash", "scripts/nglcm.sh" ]