Mohamed Abukar | 4e7e712 | 2020-03-04 10:01:45 +0200 | [diff] [blame^] | 1 | #================================================================================== |
| 2 | # Copyright (c) 2020 AT&T Intellectual Property. |
| 3 | # Copyright (c) 2020 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. |
| 16 | # |
| 17 | # This source code is part of the near-RT RIC (RAN Intelligent Controller) |
| 18 | # platform project (RICP). |
| 19 | #================================================================================== |
| 20 | |
| 21 | # The CI system creates and publishes the alarm-adapter 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 | |
| 25 | #FROM golang:1.12.1 as alarmadapter |
| 26 | FROM nexus3.o-ran-sc.org:10004/bldr-ubuntu18-c-go:3-u18.04-nng as alarmadapter |
| 27 | |
| 28 | RUN apt update && apt install -y iputils-ping net-tools curl |
| 29 | |
| 30 | # Install RMr shared library & development header files |
| 31 | ARG RMRVERSION=3.2.4 |
| 32 | 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 |
| 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 |
| 34 | |
| 35 | ENV GOLANG_VERSION 1.12.1 |
| 36 | RUN wget --quiet https://dl.google.com/go/go$GOLANG_VERSION.linux-amd64.tar.gz \ |
| 37 | && tar xvzf go$GOLANG_VERSION.linux-amd64.tar.gz -C /usr/local |
| 38 | ENV PATH="/usr/local/go/bin:${PATH}" |
| 39 | ENV GOPATH /go |
| 40 | |
| 41 | RUN mkdir -p /go/bin |
| 42 | RUN cd /go/bin \ |
| 43 | && wget --quiet https://github.com/go-swagger/go-swagger/releases/download/v0.19.0/swagger_linux_amd64 \ |
| 44 | && mv swagger_linux_amd64 swagger \ |
| 45 | && chmod +x swagger |
| 46 | |
| 47 | RUN mkdir -p /go/src/alarm-adapter |
| 48 | WORKDIR "/go/src/alarm-adapter" |
| 49 | COPY go.sum . |
| 50 | COPY go.mod . |
| 51 | |
| 52 | RUN go mod download |
| 53 | |
| 54 | COPY . /go/src/alarm-adapter |
| 55 | WORKDIR "/go/src/alarm-adapter/adapter" |
| 56 | |
| 57 | # build and run UT |
| 58 | RUN ldconfig |
| 59 | RUN ./build_adapter.sh |
| 60 | |
| 61 | # Final, executable container |
| 62 | FROM ubuntu:16.04 |
| 63 | |
| 64 | COPY --from=alarmadapter /go/src/alarm-adapter/adapter/run_adapter.sh / |
| 65 | COPY --from=alarmadapter /go/src/alarm-adapter/adapter/alarm-adapter / |
| 66 | COPY --from=alarmadapter /go/src/alarm-adapter/config/* / |
| 67 | COPY --from=alarmadapter /usr/local/include /usr/local/include |
| 68 | COPY --from=alarmadapter /usr/local/lib /usr/local/lib |
| 69 | |
| 70 | RUN ldconfig |
| 71 | |
| 72 | RUN chmod 755 /run_adapter.sh |
| 73 | CMD /run_adapter.sh |