subhash kumar singh | e63192f | 2020-12-11 14:25:11 +0530 | [diff] [blame] | 1 | # Copyright (c) 2020 Samsung. |
| 2 | # |
| 3 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | # you may not use this file except in compliance with the License. |
| 5 | # You may obtain a copy of the License at |
| 6 | # |
| 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | # |
| 9 | # Unless required by applicable law or agreed to in writing, software |
| 10 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | # See the License for the specific language governing permissions and |
| 13 | # limitations under the License. |
| 14 | |
| 15 | #---------------------------------------------------------- |
| 16 | # |
| 17 | #---------------------------------------------------------- |
| 18 | |
subhash kumar singh | 8954026 | 2021-07-23 01:13:11 +0530 | [diff] [blame] | 19 | FROM nexus3.o-ran-sc.org:10002/o-ran-sc/bldr-ubuntu18-c-go:1.9.0 as build-hw-go |
subhash kumar singh | e63192f | 2020-12-11 14:25:11 +0530 | [diff] [blame] | 20 | |
subhash kumar singh | 8954026 | 2021-07-23 01:13:11 +0530 | [diff] [blame] | 21 | # Install utilities |
subhash kumar singh | cd49a82 | 2021-10-07 18:55:34 +0530 | [diff] [blame] | 22 | RUN apt update && apt install -y iputils-ping net-tools curl sudo ca-certificates |
subhash kumar singh | e63192f | 2020-12-11 14:25:11 +0530 | [diff] [blame] | 23 | |
subhash kumar singh | 8954026 | 2021-07-23 01:13:11 +0530 | [diff] [blame] | 24 | # Install RMr shared library & development header files |
| 25 | RUN wget --content-disposition https://packagecloud.io/o-ran-sc/release/packages/debian/stretch/rmr_4.7.0_amd64.deb/download.deb && dpkg -i rmr_4.7.0_amd64.deb && rm -rf rmr_4.7.0_amd64.deb |
| 26 | RUN wget --content-disposition https://packagecloud.io/o-ran-sc/release/packages/debian/stretch/rmr-dev_4.7.0_amd64.deb/download.deb && dpkg -i rmr-dev_4.7.0_amd64.deb && rm -rf rmr-dev_4.7.0_amd64.deb |
| 27 | |
| 28 | # Install dependencies, compile and test the module |
| 29 | RUN mkdir -p /go/src/hw-go |
| 30 | COPY . /go/src/hw-go |
| 31 | |
| 32 | WORKDIR "/go/src/hw-go" |
| 33 | |
| 34 | ENV GO111MODULE=on GO_ENABLED=0 GOOS=linux |
| 35 | |
| 36 | RUN go build -a -installsuffix cgo -o hw-go hwApp.go |
| 37 | |
| 38 | |
| 39 | # Final deployment container |
| 40 | FROM ubuntu:18.04 |
| 41 | |
| 42 | ENV CFG_FILE=config/config-file.json |
| 43 | ENV RMR_SEED_RT=config/uta_rtg.rt |
| 44 | |
| 45 | RUN mkdir /config |
| 46 | |
| 47 | COPY --from=build-hw-go /go/src/hw-go/hw-go / |
| 48 | COPY --from=build-hw-go /go/src/hw-go/config/* /config/ |
| 49 | COPY --from=build-hw-go /usr/local/lib /usr/local/lib |
| 50 | |
subhash kumar singh | e363aa9 | 2021-03-26 15:53:13 +0530 | [diff] [blame] | 51 | RUN ldconfig |
subhash kumar singh | e63192f | 2020-12-11 14:25:11 +0530 | [diff] [blame] | 52 | |
subhash kumar singh | 8954026 | 2021-07-23 01:13:11 +0530 | [diff] [blame] | 53 | RUN chmod 755 /hw-go |
| 54 | CMD /hw-go |