3d57ad5ce837fd560066ea20bdf5441928a0fc98
[it/test.git] / ric_robot_suite / docker / nanobot / Dockerfile
1    #   Copyright (c)  2019 AT&T Intellectual Property.
2    #   Copyright (c)  2020 HCL Technologies.
3    #   Licensed under the Apache License, Version 2.0 (the "License");
4    #   you may not use this file except in compliance with the License.
5    #   You may obtain a copy of the License at
6    #
7    #       http://www.apache.org/licenses/LICENSE-2.0
8    #
9    #   Unless required by applicable law or agreed to in writing, software
10    #   distributed under the License is distributed on an "AS IS" BASIS,
11    #   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12    #   See the License for the specific language governing permissions and
13    #   limitations under the License.
14
15    FROM python:3.8-alpine AS nanobot-build
16
17    RUN apk update && apk add --no-cache git build-base libffi-dev libxml2 libxslt libxml2-dev libxslt-dev openssl-dev
18    RUN apk update && apk add git gcc linux-headers libc-dev cmake pkgconfig make
19
20    ENV CRYPTOGRAPHY_DONT_BUILD_RUST=1
21    RUN pip install kubernetes
22    RUN pip install redis
23    RUN pip install asyncio
24    RUN pip install websockets
25    RUN pip install robotframework
26    RUN pip install robotframework-requests
27    RUN pip install robotframework-ncclient
28    RUN pip install UUID
29    WORKDIR /tmp/
30    RUN git clone -b 3.0.1-ONAP https://gerrit.onap.org/r/testsuite/python-testing-utils.git
31
32
33    #rmr probe for e2term
34    RUN pip install msgpack
35    RUN python3 -m pip install ricsdl
36    RUN apk add curl
37    RUN curl -LO https://storage.googleapis.com/kubernetes-release/release/v1.19.2/bin/linux/amd64/kubectl
38    RUN chmod +x ./kubectl
39    RUN mv ./kubectl /usr/local/bin/kubectl
40
41
42    RUN apk add cmake git gcc
43    WORKDIR /
44    RUN git clone https://gerrit.o-ran-sc.org/r/ric-plt/lib/rmr && \
45         cd rmr && \
46         mkdir build && \
47         cd build && \
48         cmake -DPACK_EXTERNALS=1 -DDEV_PKG=1 .. && \
49         make install
50    RUN  mkdir -p /opt/e2
51    RUN  cp /rmr/build/src/support/rmr_probe /opt/e2/
52
53
54
55    FROM python:3.8-alpine
56    MAINTAINER "RIC"
57    LABEL name="Docker image for the RIC Robot Testing Framework"
58
59    ENV ROBOT_HOME="/robot"
60    ENV ROBOT_OPTIONS="-T -d /robot/log --console verbose -C off -P /robot/lib/python"
61    ENV KUBECONFIG="/robot/etc/kubernetes-admin-conf"
62    ENV PYTHONPATH="/robot/lib/python"
63    ENV RICPLT_NAMESPACE=ricplt
64    ENV RICPLT_RELEASE_NAME=ric-full
65    ENV RICPLT_COMPONENTS="a1mediator appmgr dbaas e2mgr e2term rtmgr"
66    ENV DBAAS_SERVICE_HOST=service-ricplt-dbaas-tcp.ricplt.svc.cluster.local
67    ENV DBAAS_SERVICE_PORT=6379
68    RUN apk update && apk add libxslt
69    COPY --from=nanobot-build /usr/local/lib/python3.8 /usr/local/lib/python3.8
70    COPY --from=nanobot-build /usr/local/bin/robot /usr/local/bin
71
72    RUN apk add wget
73    RUN  mkdir -p /robot/lib/python
74    WORKDIR ric-python-utils/ricutils
75    RUN wget -o SDLWrapper.py "https://gerrit.o-ran-sc.org/r/gitweb?p=ric-plt/xapp-frame-py.git;a=blob_plain;f=ricxappframe/xapp_sdl.py"
76    # ONAP eteutils
77    # we only need a few things from this so we won't install the whole thing.
78    COPY --from=nanobot-build /tmp/python-testing-utils/eteutils/StringTemplater.py /robot/lib/python
79    COPY --from=nanobot-build /tmp/python-testing-utils/eteutils/UUID.py /robot/lib/python
80    COPY ric-python-utils/ricutils/*.py /robot/lib/python/
81
82    #
83    # for the nanobot container, we only need a subset of the various support
84    # files/libraries, so we pick and choose what to copy..
85    RUN mkdir /robot/resources
86    COPY robot/resources/json_templater.robot /robot/resources
87    COPY robot/resources/a1mediator /robot/resources/a1mediator
88    COPY robot/resources/appmgr /robot/resources/appmgr
89    COPY robot/resources/dashboard /robot/resources/dashboard
90    COPY robot/resources/e2mgr /robot/resources/e2mgr
91    COPY robot/resources/e2sim /robot/resources/e2sim
92    COPY robot/resources/e2term /robot/resources/e2term
93    COPY robot/resources/o1mediator /robot/resources/o1mediator
94    COPY robot/resources/ric /robot/resources/ric
95    COPY robot/resources/rnib /robot/resources/rnib
96    COPY robot/resources/rtmgr /robot/resources/rtmgr
97    COPY robot/resources/xapps /robot/resources/xapps
98    # this will actually be overlaid by the helm chart, but
99    # it's good to have the placeholder.
100    COPY robot/resources/global_properties.robot /robot/resources
101
102    RUN mkdir -p /robot/assets/templates
103    COPY robot/assets/templates/e2mgr_setup_nodeb.template /robot/assets/templates
104
105    RUN python -m compileall /robot/lib/python
106
107    WORKDIR /
108    CMD ["sleep", "9125d"]
109