blob: 1dc624ce00082afcd1b467788a8e55ebcbabef55 [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
prabhukaliswamye110ee02019-12-23 09:51:01 +000026FROM nexus3.o-ran-sc.org:10004/bldr-ubuntu18-c-go:3-u18.04-nng as rtmgrbuild
Balint Uveges871fa392019-04-02 20:31:11 +000027
wahidwa8596ec2019-12-05 06:30:42 +000028# Install RMr shared library
wahidwda0fd3a2020-01-01 04:28:41 +000029RUN wget --content-disposition https://packagecloud.io/o-ran-sc/staging/packages/debian/stretch/rmr_1.13.1_amd64.deb/download.deb && dpkg -i rmr_1.13.1_amd64.deb && rm -rf rmr_1.13.1_amd64.deb
wahidwa8596ec2019-12-05 06:30:42 +000030# Install RMr development header files
wahidwda0fd3a2020-01-01 04:28:41 +000031RUN wget --content-disposition https://packagecloud.io/o-ran-sc/staging/packages/debian/stretch/rmr-dev_1.13.1_amd64.deb/download.deb && dpkg -i rmr-dev_1.13.1_amd64.deb && rm -rf rmr-dev_1.13.1_amd64.deb
wahidwa8596ec2019-12-05 06:30:42 +000032
33ENV GOLANG_VERSION 1.12.1
34RUN wget --quiet https://dl.google.com/go/go$GOLANG_VERSION.linux-amd64.tar.gz \
35 && tar xvzf go$GOLANG_VERSION.linux-amd64.tar.gz -C /usr/local
36ENV PATH="/usr/local/go/bin:${PATH}"
37ENV GOPATH /go
38
39RUN mkdir -p /go/bin
kalnagy92162652019-07-02 15:15:49 +020040RUN cd /go/bin \
41 && wget --quiet https://github.com/go-swagger/go-swagger/releases/download/v0.19.0/swagger_linux_amd64 \
42 && mv swagger_linux_amd64 swagger \
43 && chmod +x swagger
44
wahidwa8596ec2019-12-05 06:30:42 +000045
kalnagy92162652019-07-02 15:15:49 +020046WORKDIR /go/src/routing-manager
zkoczkaeb2ff0d2019-09-26 16:59:54 +020047COPY api/ /go/src/routing-manager/api
48COPY LICENSE LICENSE
49RUN mkdir pkg
kalnagy92162652019-07-02 15:15:49 +020050
51RUN git clone "https://gerrit.o-ran-sc.org/r/ric-plt/appmgr" \
1000044e90ddda2019-08-01 09:58:52 +020052 && cp appmgr/api/appmgr_rest_api.yaml api/ \
kalnagy92162652019-07-02 15:15:49 +020053 && rm -rf appmgr
54
wahidwa8596ec2019-12-05 06:30:42 +000055RUN /go/bin/swagger generate server -f api/routing_manager.yaml -t pkg/ --exclude-main -r LICENSE
56RUN /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 +020057
wahidwa8596ec2019-12-05 06:30:42 +000058ENV GO111MODULE=on
59ENV GOPATH ""
60COPY go.sum go.sum
61COPY go.mod go.mod
zkoczkaeb2ff0d2019-09-26 16:59:54 +020062COPY pkg pkg
63COPY cmd cmd
64COPY run_rtmgr.sh /run_rtmgr.sh
wahidwa8596ec2019-12-05 06:30:42 +000065#RUN go mod download
66#RUN /usr/local/go/bin/go mod tidy
67ENV GOPATH /go
zkoczkaeb2ff0d2019-09-26 16:59:54 +020068
69ENV GOBIN /go/bin
70RUN go install ./cmd/rtmgr.go
kalnagy92162652019-07-02 15:15:49 +020071
72# UT intermediate container
73FROM rtmgrbuild as rtmgrut
wahidwa8596ec2019-12-05 06:30:42 +000074RUN ldconfig
75RUN go test ./pkg/sbi ./pkg/rpe ./pkg/nbi ./pkg/sdl -f "./manifests/rtmgr/rtmgr-cfg.yaml" -cover -race
76
kalnagy92162652019-07-02 15:15:49 +020077# Final, executable container
Lott, Christopher (cl778h)419d8512019-06-05 15:51:17 -040078FROM ubuntu:16.04
kalnagy92162652019-07-02 15:15:49 +020079COPY --from=rtmgrbuild /go/bin/rtmgr /
80COPY --from=rtmgrbuild /run_rtmgr.sh /
wahidwa8596ec2019-12-05 06:30:42 +000081COPY --from=rtmgrbuild /usr/local/include /usr/local/include
82COPY --from=rtmgrbuild /usr/local/lib /usr/local/lib
83RUN ldconfig
wahidw5e864c72019-12-10 05:02:10 +000084RUN apt-get update && apt-get install -y iputils-ping net-tools curl tcpdump
kalnagy92162652019-07-02 15:15:49 +020085RUN mkdir /db && touch /db/rt.json && chmod 777 /db/rt.json
wriderd0f65092019-07-09 16:38:09 -040086RUN chmod 755 /run_rtmgr.sh
kalnagy92162652019-07-02 15:15:49 +020087CMD /run_rtmgr.sh