2 #==================================================================================
3 # Copyright (c) 2019 AT&T Intellectual Property.
4 # Copyright (c) 2019 Nokia
6 # Licensed under the Apache License, Version 2.0 (the "License");
7 # you may not use this file except in compliance with the License.
8 # You may obtain a copy of the License at
10 # http://www.apache.org/licenses/LICENSE-2.0
12 # Unless required by applicable law or agreed to in writing, software
13 # distributed under the License is distributed on an "AS IS" BASIS,
14 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 # See the License for the specific language governing permissions and
16 # limitations under the License.
17 #==================================================================================
20 # Abstract: Builds a container to compile Subscription Manager's code
23 FROM nexus3.o-ran-sc.org:10004/bldr-ubuntu18-c-go:3-u18.04-nng as submgrbuild
25 RUN apt update && apt install -y iputils-ping net-tools curl tcpdump gdb
30 # Install RMr shared library
31 RUN 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
32 # Install RMr development header files
33 RUN 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
35 # "PULLING LOG and COMPILING LOG"
36 #RUN git clone "https://gerrit.o-ran-sc.org/r/com/log" /opt/log && cd /opt/log && \
37 # ./autogen.sh && ./configure && make install && ldconfig
39 # "Installing Swagger"
40 RUN cd /usr/local/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 \
53 ENV CFLAGS="-DASN_DISABLE_OER_SUPPORT"
54 ENV CGO_CFLAGS="-DASN_DISABLE_OER_SUPPORT"
56 COPY 3rdparty 3rdparty
57 RUN cd 3rdparty/libe2ap && \
58 gcc -c ${CFLAGS} -I. -fPIC *.c && \
59 gcc *.o -shared -o libe2ap.so && \
60 cp libe2ap.so /usr/local/lib/ && \
61 cp *.h /usr/local/include/ && \
65 RUN cd e2ap/libe2ap_wrapper && \
66 gcc -c ${CFLAGS} -fPIC *.c && \
67 gcc *.o -shared -o libe2ap_wrapper.so && \
68 cp libe2ap_wrapper.so /usr/local/lib/ && \
69 cp *.h /usr/local/include/ && \
73 RUN cd e2ap && /usr/local/go/bin/go test -v ./pkg/conv
74 RUN cd e2ap && /usr/local/go/bin/go test -v ./pkg/e2ap_wrapper
76 # test formating (not important)
77 RUN cd e2ap && test -z "$(/usr/local/go/bin/gofmt -l pkg/conv/*.go)"
78 RUN cd e2ap && test -z "$(/usr/local/go/bin/gofmt -l pkg/e2ap_wrapper/*.go)"
79 RUN cd e2ap && test -z "$(/usr/local/go/bin/gofmt -l pkg/e2ap/*.go)"
80 RUN cd e2ap && test -z "$(/usr/local/go/bin/gofmt -l pkg/e2ap/e2ap_tests/*.go)"
88 RUN /usr/local/go/bin/go mod download
95 # "Getting and generating routing managers api client"
96 RUN git clone "https://gerrit.o-ran-sc.org/r/ric-plt/rtmgr" \
97 && cp rtmgr/api/routing_manager.yaml api/ \
100 RUN mkdir -p /root/go && \
101 /usr/local/go/bin/swagger generate client -f api/routing_manager.yaml -t pkg/ -m rtmgr_models -c rtmgr_client
109 RUN mkdir -p /opt/bin && \
110 /usr/local/go/bin/go build -o /opt/bin/submgr cmd/submgr.go && \
111 mkdir -p /opt/build/container/usr/local
114 RUN /usr/local/go/bin/go mod tidy
117 COPY test/config-file.json test/config-file.json
118 ENV CFG_FILE=/opt/submgr/test/config-file.json
120 RUN /usr/local/go/bin/go test -test.coverprofile /tmp/submgr_cover.out -count=1 -v ./pkg/control
122 RUN /usr/local/go/bin/go tool cover -html=/tmp/submgr_cover.out -o /tmp/submgr_cover.html
124 # test formating (not important)
125 RUN test -z "$(/usr/local/go/bin/gofmt -l pkg/control/*.go)"
132 RUN apt update && apt install -y iputils-ping net-tools curl tcpdump
135 COPY --from=submgrbuild /opt/bin/submgr /
136 COPY --from=submgrbuild /usr/local/include /usr/local/include
137 COPY --from=submgrbuild /usr/local/lib /usr/local/lib
140 RUN chmod 755 /run_submgr.sh