RIC:1060: Change in PTL
[ric-plt/rtmgr.git] / Dockerfile
1 #==================================================================================
2 #   Copyright (c) 2019 AT&T Intellectual Property.
3 #   Copyright (c) 2019 Nokia
4 #
5 #   Licensed under the Apache License, Version 2.0 (the "License");
6 #   you may not use this file except in compliance with the License.
7 #   You may obtain a copy of the License at
8 #
9 #       http://www.apache.org/licenses/LICENSE-2.0
10 #
11 #   Unless required by applicable law or agreed to in writing, software
12 #   distributed under the License is distributed on an "AS IS" BASIS,
13 #   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 #   See the License for the specific language governing permissions and
15 #   limitations under the License.
16 #
17 #   This source code is part of the near-RT RIC (RAN Intelligent Controller)
18 #   platform project (RICP).
19 #==================================================================================
20
21 # The CI system creates and publishes the rtmgr Docker image
22 # from the last step in this multi-stage build and applies 
23 # a Docker tag from the string in file container-tag.yaml
24
25 #FROM golang:1.12.1 as rtmgrbuild
26 FROM nexus3.o-ran-sc.org:10002/o-ran-sc/bldr-ubuntu20-c-go:1.0.0 as rtmgrbuild
27
28 RUN apt update && apt install ca-certificates libgnutls30 -y
29 # Install RMr shared library
30 ARG RMRVERSION=4.9.4
31 RUN wget --content-disposition https://packagecloud.io/o-ran-sc/release/packages/debian/stretch/rmr_${RMRVERSION}_amd64.deb/download.deb && dpkg -i rmr_${RMRVERSION}_amd64.deb && rm -rf rmr_${RMRVERSION}_amd64.deb
32 # Install RMr development header files
33 RUN wget --content-disposition https://packagecloud.io/o-ran-sc/release/packages/debian/stretch/rmr-dev_${RMRVERSION}_amd64.deb/download.deb && dpkg -i rmr-dev_${RMRVERSION}_amd64.deb && rm -rf rmr-dev_${RMRVERSION}_amd64.deb
34
35 #ENV GOLANG_VERSION 1.16
36 #RUN wget --quiet https://dl.google.com/go/go$GOLANG_VERSION.linux-amd64.tar.gz \
37 #     && tar xvzf go$GOLANG_VERSION.linux-amd64.tar.gz -C /usr/local 
38 #ENV PATH="/usr/local/go/bin:${PATH}"
39 ENV GOPATH /go
40
41 RUN mkdir -p /go/bin
42 RUN cd /go/bin \
43     && wget --quiet https://github.com/go-swagger/go-swagger/releases/download/v0.19.0/swagger_linux_amd64 \
44     && mv swagger_linux_amd64 swagger \
45     && chmod +x swagger
46
47
48 WORKDIR /go/src/routing-manager
49 COPY api/ /go/src/routing-manager/api
50 COPY LICENSE LICENSE
51 RUN mkdir pkg
52
53 RUN git clone "https://gerrit.o-ran-sc.org/r/ric-plt/appmgr" \
54     && cp appmgr/api/appmgr_rest_api.yaml api/ \
55     && rm -rf appmgr
56
57 RUN /go/bin/swagger generate server -f api/routing_manager.yaml -t pkg/ --exclude-main -r LICENSE
58 RUN /go/bin/swagger generate client -f api/appmgr_rest_api.yaml -t pkg/ -m appmgr_model -c appmgr_client -r LICENSE
59
60 ENV GO111MODULE=on 
61 ENV GOPATH ""
62 COPY go.sum go.sum
63 COPY go.mod go.mod
64 COPY pkg pkg
65 COPY cmd cmd
66 COPY run_rtmgr.sh /run_rtmgr.sh
67 RUN mkdir manifests
68 COPY manifests/ /go/src/routing-manager/manifests
69 COPY "uta_rtg_ric.rt" /
70 ENV GOPATH /go
71
72 ENV GOBIN /go/bin
73 RUN go mod download
74 RUN go install ./cmd/rtmgr.go
75
76 # UT intermediate container
77 #FROM rtmgrbuild as rtmgrut
78 #RUN ldconfig
79 #ENV RMR_SEED_RT "/uta_rtg_ric.rt"
80 #RUN go test ./pkg/sbi ./pkg/rpe ./pkg/nbi ./pkg/sdl -f "/go/src/routing-manager/manifests/rtmgr/rtmgr-cfg.yaml" -cover -race
81
82 # Final, executable container
83 FROM ubuntu:20.04
84 COPY --from=rtmgrbuild /go/bin/rtmgr /
85 COPY --from=rtmgrbuild /run_rtmgr.sh /
86 COPY --from=rtmgrbuild /usr/local/include /usr/local/include
87 COPY --from=rtmgrbuild /usr/local/lib /usr/local/lib
88 COPY "uta_rtg_ric.rt" /
89 RUN ldconfig
90 RUN apt-get update && apt-get install -y iputils-ping net-tools curl tcpdump
91 RUN mkdir /db && touch /db/rt.json && chmod 777 /db/rt.json
92 RUN chmod 755 /run_rtmgr.sh
93 CMD /run_rtmgr.sh