kalnagy | 303e57c | 2019-06-28 15:28:35 +0200 | [diff] [blame] | 1 | # |
| 2 | #================================================================================== |
| 3 | # Copyright (c) 2019 AT&T Intellectual Property. |
| 4 | # Copyright (c) 2019 Nokia |
| 5 | # |
| 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 |
| 9 | # |
| 10 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | # |
| 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 | #================================================================================== |
| 18 | # |
| 19 | # |
| 20 | # Abstract: Builds a container to compile Subscription Manager's code |
| 21 | # Date: 28 May 2019 |
| 22 | # |
kalnagy | 1455c85 | 2019-10-21 13:06:23 +0200 | [diff] [blame] | 23 | FROM nexus3.o-ran-sc.org:10004/bldr-ubuntu18-c-go:2-u18.04-nng as submgrbuild |
kalnagy | 303e57c | 2019-06-28 15:28:35 +0200 | [diff] [blame] | 24 | |
Juha Hyttinen | ff8dccd | 2019-12-10 14:34:07 +0200 | [diff] [blame^] | 25 | RUN apt update && apt install -y iputils-ping net-tools curl tcpdump gdb |
| 26 | |
kalnagy | e001868 | 2019-09-26 16:28:25 +0200 | [diff] [blame] | 27 | WORKDIR /tmp |
kalnagy | 303e57c | 2019-06-28 15:28:35 +0200 | [diff] [blame] | 28 | |
| 29 | # Install RMr shared library |
Anssi Mannila | f1d0eb6 | 2019-12-17 15:29:55 +0200 | [diff] [blame] | 30 | RUN wget --content-disposition https://packagecloud.io/o-ran-sc/staging/packages/debian/stretch/rmr_1.10.0_amd64.deb/download.deb && dpkg -i rmr_1.10.0_amd64.deb && rm -rf rmr_1.10.0_amd64.deb |
kalnagy | 303e57c | 2019-06-28 15:28:35 +0200 | [diff] [blame] | 31 | # Install RMr development header files |
Anssi Mannila | f1d0eb6 | 2019-12-17 15:29:55 +0200 | [diff] [blame] | 32 | RUN wget --content-disposition https://packagecloud.io/o-ran-sc/staging/packages/debian/stretch/rmr-dev_1.10.0_amd64.deb/download.deb && dpkg -i rmr-dev_1.10.0_amd64.deb && rm -rf rmr-dev_1.10.0_amd64.deb |
kalnagy | 303e57c | 2019-06-28 15:28:35 +0200 | [diff] [blame] | 33 | |
| 34 | # "PULLING LOG and COMPILING LOG" |
Juha Hyttinen | ff8dccd | 2019-12-10 14:34:07 +0200 | [diff] [blame^] | 35 | #RUN git clone "https://gerrit.o-ran-sc.org/r/com/log" /opt/log && cd /opt/log && \ |
| 36 | # ./autogen.sh && ./configure && make install && ldconfig |
kalnagy | 303e57c | 2019-06-28 15:28:35 +0200 | [diff] [blame] | 37 | |
kalnagy | 93cc3e2 | 2019-09-19 11:29:29 +0200 | [diff] [blame] | 38 | # "Installing Swagger" |
| 39 | RUN cd /usr/local/go/bin \ |
| 40 | && wget --quiet https://github.com/go-swagger/go-swagger/releases/download/v0.19.0/swagger_linux_amd64 \ |
| 41 | && mv swagger_linux_amd64 swagger \ |
| 42 | && chmod +x swagger |
| 43 | |
kalnagy | e001868 | 2019-09-26 16:28:25 +0200 | [diff] [blame] | 44 | |
| 45 | WORKDIR /opt/submgr |
kalnagy | e001868 | 2019-09-26 16:28:25 +0200 | [diff] [blame] | 46 | |
Juha Hyttinen | ff8dccd | 2019-12-10 14:34:07 +0200 | [diff] [blame^] | 47 | RUN mkdir pkg |
| 48 | |
| 49 | # |
| 50 | # |
| 51 | # |
| 52 | ENV CFLAGS="-DASN_DISABLE_OER_SUPPORT" |
| 53 | ENV CGO_CFLAGS="-DASN_DISABLE_OER_SUPPORT" |
| 54 | |
| 55 | COPY 3rdparty 3rdparty |
| 56 | RUN cd 3rdparty/libe2ap && \ |
| 57 | gcc -c ${CFLAGS} -I. -fPIC *.c && \ |
| 58 | gcc *.o -shared -o libe2ap.so && \ |
| 59 | cp libe2ap.so /usr/local/lib/ && \ |
| 60 | cp *.h /usr/local/include/ && \ |
kalnagy | e001868 | 2019-09-26 16:28:25 +0200 | [diff] [blame] | 61 | ldconfig |
| 62 | |
Juha Hyttinen | ff8dccd | 2019-12-10 14:34:07 +0200 | [diff] [blame^] | 63 | COPY e2ap e2ap |
| 64 | RUN cd e2ap/libe2ap_wrapper && \ |
| 65 | gcc -c ${CFLAGS} -fPIC *.c && \ |
| 66 | gcc *.o -shared -o libe2ap_wrapper.so && \ |
| 67 | cp libe2ap_wrapper.so /usr/local/lib/ && \ |
| 68 | cp *.h /usr/local/include/ && \ |
| 69 | ldconfig |
| 70 | |
| 71 | # unittest |
| 72 | RUN cd e2ap && /usr/local/go/bin/go test -v ./pkg/conv |
| 73 | RUN cd e2ap && /usr/local/go/bin/go test -v ./pkg/e2ap_wrapper |
| 74 | |
| 75 | # test formating (not important) |
| 76 | RUN cd e2ap && test -z "$(/usr/local/go/bin/gofmt -l pkg/conv/*.go)" |
| 77 | RUN cd e2ap && test -z "$(/usr/local/go/bin/gofmt -l pkg/e2ap_wrapper/*.go)" |
| 78 | RUN cd e2ap && test -z "$(/usr/local/go/bin/gofmt -l pkg/e2ap/*.go)" |
| 79 | RUN cd e2ap && test -z "$(/usr/local/go/bin/gofmt -l pkg/e2ap/e2ap_tests/*.go)" |
| 80 | |
| 81 | # |
| 82 | # |
| 83 | # |
| 84 | COPY go.mod go.mod |
| 85 | COPY go.sum go.sum |
| 86 | |
| 87 | RUN /usr/local/go/bin/go mod download |
| 88 | |
| 89 | # |
| 90 | # |
| 91 | # |
kalnagy | e001868 | 2019-09-26 16:28:25 +0200 | [diff] [blame] | 92 | COPY api api |
| 93 | |
kalnagy | 93cc3e2 | 2019-09-19 11:29:29 +0200 | [diff] [blame] | 94 | # "Getting and generating routing managers api client" |
kalnagy | e001868 | 2019-09-26 16:28:25 +0200 | [diff] [blame] | 95 | RUN git clone "https://gerrit.o-ran-sc.org/r/ric-plt/rtmgr" \ |
kalnagy | 93cc3e2 | 2019-09-19 11:29:29 +0200 | [diff] [blame] | 96 | && cp rtmgr/api/routing_manager.yaml api/ \ |
| 97 | && rm -rf rtmgr |
| 98 | |
kalnagy | e001868 | 2019-09-26 16:28:25 +0200 | [diff] [blame] | 99 | RUN mkdir -p /root/go && \ |
| 100 | /usr/local/go/bin/swagger generate client -f api/routing_manager.yaml -t pkg/ -m rtmgr_models -c rtmgr_client |
| 101 | |
Juha Hyttinen | ff8dccd | 2019-12-10 14:34:07 +0200 | [diff] [blame^] | 102 | # |
| 103 | # |
| 104 | # |
kalnagy | e001868 | 2019-09-26 16:28:25 +0200 | [diff] [blame] | 105 | COPY pkg pkg |
| 106 | COPY cmd cmd |
| 107 | |
kalnagy | e001868 | 2019-09-26 16:28:25 +0200 | [diff] [blame] | 108 | RUN mkdir -p /opt/bin && \ |
Juha Hyttinen | ff8dccd | 2019-12-10 14:34:07 +0200 | [diff] [blame^] | 109 | /usr/local/go/bin/go build -o /opt/bin/submgr cmd/submgr.go && \ |
| 110 | mkdir -p /opt/build/container/usr/local |
kalnagy | 303e57c | 2019-06-28 15:28:35 +0200 | [diff] [blame] | 111 | |
Juha Hyttinen | ff8dccd | 2019-12-10 14:34:07 +0200 | [diff] [blame^] | 112 | |
| 113 | RUN /usr/local/go/bin/go mod tidy |
| 114 | |
| 115 | # unittest |
| 116 | COPY test/config-file.json test/config-file.json |
| 117 | ENV CFG_FILE=/opt/submgr/test/config-file.json |
| 118 | RUN /usr/local/go/bin/go test -count=1 -v ./pkg/control |
| 119 | |
| 120 | # test formating (not important) |
| 121 | RUN test -z "$(/usr/local/go/bin/gofmt -l pkg/control/*.go)" |
| 122 | |
| 123 | # |
| 124 | # |
| 125 | # |
kalnagy | 303e57c | 2019-06-28 15:28:35 +0200 | [diff] [blame] | 126 | FROM ubuntu:18.04 |
| 127 | |
Balint Uveges | cd3881b | 2019-10-02 15:01:43 +0000 | [diff] [blame] | 128 | RUN apt update && apt install -y iputils-ping net-tools curl tcpdump |
| 129 | |
kalnagy | 303e57c | 2019-06-28 15:28:35 +0200 | [diff] [blame] | 130 | COPY run_submgr.sh / |
Balint Uveges | 534c882 | 2019-10-09 08:54:53 +0000 | [diff] [blame] | 131 | COPY --from=submgrbuild /opt/bin/submgr / |
kalnagy | 303e57c | 2019-06-28 15:28:35 +0200 | [diff] [blame] | 132 | COPY --from=submgrbuild /usr/local/include /usr/local/include |
| 133 | COPY --from=submgrbuild /usr/local/lib /usr/local/lib |
| 134 | RUN ldconfig |
| 135 | |
kalnagy | 93cc3e2 | 2019-09-19 11:29:29 +0200 | [diff] [blame] | 136 | RUN chmod 755 /run_submgr.sh |
kalnagy | e001868 | 2019-09-26 16:28:25 +0200 | [diff] [blame] | 137 | CMD /run_submgr.sh |