blob: d8f55e8c585596ab7ae712f959d936ca84db85f7 [file] [log] [blame]
Balint Uveges871fa392019-04-02 20:31:11 +00001#==================================================================================
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.
wahidwa8596ec2019-12-05 06:30:42 +000016#
17# This source code is part of the near-RT RIC (RAN Intelligent Controller)
18# platform project (RICP).
Balint Uveges871fa392019-04-02 20:31:11 +000019#==================================================================================
Balint Uveges871fa392019-04-02 20:31:11 +000020
Lott, Christopher (cl778h)419d8512019-06-05 15:51:17 -040021# 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
wahidwa8596ec2019-12-05 06:30:42 +000025#FROM golang:1.12.1 as rtmgrbuild
wahidwa3325022020-04-21 05:01:26 +000026FROM nexus3.o-ran-sc.org:10004/bldr-ubuntu18-c-go:6-u18.04-nng as rtmgrbuild
Balint Uveges871fa392019-04-02 20:31:11 +000027
wahidwa8596ec2019-12-05 06:30:42 +000028# Install RMr shared library
wahidwa3325022020-04-21 05:01:26 +000029ARG RMRVERSION=3.8.0
wahidwdd6b0562020-03-31 03:09:45 +000030RUN wget --content-disposition https://packagecloud.io/o-ran-sc/staging/packages/debian/stretch/rmr_${RMRVERSION}_amd64.deb/download.deb && dpkg -i rmr_${RMRVERSION}_amd64.deb && rm -rf rmr_${RMRVERSION}_amd64.deb
wahidwa8596ec2019-12-05 06:30:42 +000031# Install RMr development header files
wahidwdd6b0562020-03-31 03:09:45 +000032RUN wget --content-disposition https://packagecloud.io/o-ran-sc/staging/packages/debian/stretch/rmr-dev_${RMRVERSION}_amd64.deb/download.deb && dpkg -i rmr-dev_${RMRVERSION}_amd64.deb && rm -rf rmr-dev_${RMRVERSION}_amd64.deb
wahidwa8596ec2019-12-05 06:30:42 +000033
34ENV GOLANG_VERSION 1.12.1
35RUN wget --quiet https://dl.google.com/go/go$GOLANG_VERSION.linux-amd64.tar.gz \
36 && tar xvzf go$GOLANG_VERSION.linux-amd64.tar.gz -C /usr/local
37ENV PATH="/usr/local/go/bin:${PATH}"
38ENV GOPATH /go
39
40RUN mkdir -p /go/bin
kalnagy92162652019-07-02 15:15:49 +020041RUN cd /go/bin \
42 && wget --quiet https://github.com/go-swagger/go-swagger/releases/download/v0.19.0/swagger_linux_amd64 \
43 && mv swagger_linux_amd64 swagger \
44 && chmod +x swagger
45
wahidwa8596ec2019-12-05 06:30:42 +000046
kalnagy92162652019-07-02 15:15:49 +020047WORKDIR /go/src/routing-manager
zkoczkaeb2ff0d2019-09-26 16:59:54 +020048COPY api/ /go/src/routing-manager/api
49COPY LICENSE LICENSE
50RUN mkdir pkg
kalnagy92162652019-07-02 15:15:49 +020051
52RUN git clone "https://gerrit.o-ran-sc.org/r/ric-plt/appmgr" \
1000044e90ddda2019-08-01 09:58:52 +020053 && cp appmgr/api/appmgr_rest_api.yaml api/ \
kalnagy92162652019-07-02 15:15:49 +020054 && rm -rf appmgr
55
wahidwa8596ec2019-12-05 06:30:42 +000056RUN /go/bin/swagger generate server -f api/routing_manager.yaml -t pkg/ --exclude-main -r LICENSE
57RUN /go/bin/swagger generate client -f api/appmgr_rest_api.yaml -t pkg/ -m appmgr_model -c appmgr_client -r LICENSE
kalnagy92162652019-07-02 15:15:49 +020058
wahidwa8596ec2019-12-05 06:30:42 +000059ENV GO111MODULE=on
60ENV GOPATH ""
61COPY go.sum go.sum
62COPY go.mod go.mod
zkoczkaeb2ff0d2019-09-26 16:59:54 +020063COPY pkg pkg
64COPY cmd cmd
65COPY run_rtmgr.sh /run_rtmgr.sh
wahidwdd6b0562020-03-31 03:09:45 +000066RUN mkdir manifests
67COPY manifests/ /go/src/routing-manager/manifests
wahidw480359e2020-04-06 06:56:02 +000068COPY "uta_rtg_ric.rt" /
wahidwa8596ec2019-12-05 06:30:42 +000069ENV GOPATH /go
zkoczkaeb2ff0d2019-09-26 16:59:54 +020070
71ENV GOBIN /go/bin
72RUN go install ./cmd/rtmgr.go
kalnagy92162652019-07-02 15:15:49 +020073
74# UT intermediate container
wahidwfc1f59a2020-04-07 13:32:41 +053075#FROM rtmgrbuild as rtmgrut
76#RUN ldconfig
77#ENV RMR_SEED_RT "/uta_rtg_ric.rt"
78#RUN go test ./pkg/sbi ./pkg/rpe ./pkg/nbi ./pkg/sdl -f "/go/src/routing-manager/manifests/rtmgr/rtmgr-cfg.yaml" -cover -race
wahidwa8596ec2019-12-05 06:30:42 +000079
kalnagy92162652019-07-02 15:15:49 +020080# Final, executable container
wahidw480359e2020-04-06 06:56:02 +000081FROM ubuntu:18.04
kalnagy92162652019-07-02 15:15:49 +020082COPY --from=rtmgrbuild /go/bin/rtmgr /
83COPY --from=rtmgrbuild /run_rtmgr.sh /
wahidwa8596ec2019-12-05 06:30:42 +000084COPY --from=rtmgrbuild /usr/local/include /usr/local/include
85COPY --from=rtmgrbuild /usr/local/lib /usr/local/lib
wahidw598215e2020-03-31 10:36:36 +000086COPY "uta_rtg_ric.rt" /
wahidwa8596ec2019-12-05 06:30:42 +000087RUN ldconfig
wahidw5e864c72019-12-10 05:02:10 +000088RUN apt-get update && apt-get install -y iputils-ping net-tools curl tcpdump
kalnagy92162652019-07-02 15:15:49 +020089RUN mkdir /db && touch /db/rt.json && chmod 777 /db/rt.json
wriderd0f65092019-07-09 16:38:09 -040090RUN chmod 755 /run_rtmgr.sh
kalnagy92162652019-07-02 15:15:49 +020091CMD /run_rtmgr.sh