Add Dockerfile to support unit testing alarm-go
[ric-plt/alarm-go.git] / alarm / Dockerfile-Unit-Test
diff --git a/alarm/Dockerfile-Unit-Test b/alarm/Dockerfile-Unit-Test
new file mode 100644 (file)
index 0000000..a530771
--- /dev/null
@@ -0,0 +1,35 @@
+# Copyright (c) 2020 AT&T Intellectual Property.
+# Copyright (c) 2020 Nokia.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# This source code is part of the near-RT RIC (RAN Intelligent Controller)
+# platform project (RICP).
+#
+# Test the alarm library by issuing this command from the alarm/ subdirectory:
+#    docker build -f Dockerfile-Unit-Test .
+
+FROM golang:1.12
+
+# install rmr headers and libraries
+ARG RMRVERSION=4.0.5
+RUN wget -nv --content-disposition https://packagecloud.io/o-ran-sc/release/packages/debian/stretch/rmr_${RMRVERSION}_amd64.deb/download.deb \
+    && dpkg -i rmr_${RMRVERSION}_amd64.deb \
+    && rm -rf rmr_${RMRVERSION}_amd64.deb
+RUN wget -nv --content-disposition https://packagecloud.io/o-ran-sc/release/packages/debian/stretch/rmr-dev_${RMRVERSION}_amd64.deb/download.deb \
+    && dpkg -i rmr-dev_${RMRVERSION}_amd64.deb \
+    && rm -rf rmr-dev_${RMRVERSION}_amd64.deb
+RUN ldconfig
+RUN mkdir -p /tmp/alarm
+COPY . /tmp/alarm
+RUN cd /tmp/alarm && go test . -v