Initial version of the unified Dockerfile 32/432/6
authorkalnagy <kalman.nagy@nokia.com>
Fri, 28 Jun 2019 13:28:35 +0000 (15:28 +0200)
committerkalnagy <kalman.nagy@nokia.com>
Wed, 10 Jul 2019 13:46:35 +0000 (15:46 +0200)
Change-Id: I6cd63cdabf005cd3faa512059373f553de975012
Signed-off-by: kalnagy <kalman.nagy@nokia.com>
18 files changed:
Dockerfile [new file with mode: 0644]
README.md
RELNOTES
build.sh [deleted file]
build/binary/Dockerfile [deleted file]
build/binary/compile.sh [deleted file]
build/container/Dockerfile [deleted file]
container-tag.yaml [new file with mode: 0644]
manifests/submgr/submgr-dep.yaml
pkg/control/libe2ap.a [deleted file]
run_submgr.sh [moved from build/container/run_submgr.sh with 100% similarity, mode: 0755]
test/e2t/build.sh [changed mode: 0644->0755]
test/e2t/container/Dockerfile
test/e2t/container/e2t.yaml [deleted file]
test/e2t/container/run_e2t.sh [changed mode: 0644->0755]
test/rco/build.sh [changed mode: 0644->0755]
test/rco/container/Dockerfile
test/rco/container/run_rco.sh [changed mode: 0644->0755]

diff --git a/Dockerfile b/Dockerfile
new file mode 100644 (file)
index 0000000..0cfc320
--- /dev/null
@@ -0,0 +1,50 @@
+#
+#==================================================================================
+#   Copyright (c) 2019 AT&T Intellectual Property.
+#   Copyright (c) 2019 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.
+#==================================================================================
+#
+#
+#      Abstract:       Builds a container to compile Subscription Manager's code
+#      Date:           28 May 2019
+#
+FROM nexus3.o-ran-sc.org:10004/bldr-ubuntu18-c-go:1-u18.04-nng1.1.1 as submgrbuild
+
+COPY . /opt/submgr
+
+# Install RMr shared library
+RUN wget --content-disposition https://packagecloud.io/o-ran-sc/master/packages/debian/stretch/rmr_1.0.36_amd64.deb/download.deb && dpkg -i rmr_1.0.36_amd64.deb
+# Install RMr development header files
+RUN wget --content-disposition https://packagecloud.io/o-ran-sc/master/packages/debian/stretch/rmr-dev_1.0.36_amd64.deb/download.deb && dpkg -i rmr-dev_1.0.36_amd64.deb
+
+# "PULLING LOG and COMPILING LOG"
+RUN git clone "https://gerrit.o-ran-sc.org/r/com/log" /opt/log && cd /opt/log && \
+ ./autogen.sh && ./configure && make install && ldconfig
+
+# "COMPILING Subscription manager"
+RUN mkdir -p /opt/bin && cd /opt/submgr && \
+ /usr/local/go/bin/go get && \
+  /usr/local/go/bin/go build -o /opt/bin/submgr ./cmd/submgr.go && \
+     mkdir -p /opt/build/container/usr/local
+
+FROM ubuntu:18.04
+
+COPY --from=submgrbuild /opt/bin/submgr /opt/submgr/config/submgr.yaml /
+COPY run_submgr.sh /
+COPY --from=submgrbuild /usr/local/include /usr/local/include
+COPY --from=submgrbuild /usr/local/lib /usr/local/lib
+RUN ldconfig
+
+CMD /run_submgr.sh
\ No newline at end of file
index 361baf2..fa66227 100644 (file)
--- a/README.md
+++ b/README.md
@@ -43,10 +43,10 @@ Check the separated `RELNOTES` file.
 ## Installation guide
 
 ### Compiling code
-Enter the project root and execute `./build.sh` script.
-The build script has two main phases. First is the code compilation, where it creates a temporary container for downloading all dependencies then compiles the code. In the second phase it builds the production ready container and taggs it to `submgr:builder`
+Enter the project root and execute ` docker build -t submgr:tag .`.
+The Dockerfile has two main phases. First is the code compilation, where it creates an intermediate container for downloading all dependencies then compiles the code. In the second phase it builds the production ready container.
 
-**NOTE:** The script puts a copy of the binary into the `./bin` folder for further use cases
+**NOTE:** If you are behind proxy, see this guide: https://docs.docker.com/network/proxy/#configure-the-docker-client
 
 ### Installing Subscription Manager
 #### Preparing environment
index 99d79ef..f9df805 100644 (file)
--- a/RELNOTES
+++ b/RELNOTES
@@ -1,3 +1,5 @@
+### v0.1.1
+* Dockerfile updates
 ### v0.1.0i
 * Receives and Forwards RMR Subscription Requests
 * Introduces RCO (Stub xApp) and E2T (Stub Platform Component) for testing purposes
diff --git a/build.sh b/build.sh
deleted file mode 100644 (file)
index 5252b7d..0000000
--- a/build.sh
+++ /dev/null
@@ -1,39 +0,0 @@
-#!/bin/sh -e
-#
-#==================================================================================
-#   Copyright (c) 2019 AT&T Intellectual Property.
-#   Copyright (c) 2019 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.
-#==================================================================================
-#
-#
-#      Mnemonic:       build.sh
-#      Abstract:       Compiles the Subscription Manager's source and builds the docker container
-#      Date:           28 May 2019
-#
-
-echo 'Creating compiler container'
-docker build --no-cache --tag=submgr_compiler:0.1 $PWD/build/binary/
-
-echo 'Running submgr compiler'
-docker run --rm -v ${PWD}:/opt submgr_compiler:0.1
-
-echo 'Cleaning up compiler container'
-docker rmi -f submgr_compiler:0.1
-
-echo 'submgr binary successfully built!'
-
-echo 'Creating submgr container'
-docker build --no-cache --tag=submgr:builder ${PWD}/build/container/
-
diff --git a/build/binary/Dockerfile b/build/binary/Dockerfile
deleted file mode 100644 (file)
index 6a5f2a1..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-#
-#==================================================================================
-#   Copyright (c) 2019 AT&T Intellectual Property.
-#   Copyright (c) 2019 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.
-#==================================================================================
-#
-#
-#      Abstract:       Builds a container to compile Subscription Manager's code
-#      Date:           28 May 2019
-#
-FROM golang:1.12
-
-COPY compile.sh /
-RUN apt-get update \
-    && apt-get install -y git vim build-essential cmake ksh autotools-dev dh-autoreconf gawk autoconf-archive
-
-ENTRYPOINT /compile.sh
diff --git a/build/binary/compile.sh b/build/binary/compile.sh
deleted file mode 100644 (file)
index 592f806..0000000
+++ /dev/null
@@ -1,67 +0,0 @@
-#!/bin/sh -e
-#
-#==================================================================================
-#   Copyright (c) 2019 AT&T Intellectual Property.
-#   Copyright (c) 2019 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.
-#==================================================================================
-#
-#
-#      Mnemonic:       compile.sh
-#      Abstract:       Compiles the source of Subscription Manager service and the two platform component stubs
-#      Date:           28 May 2019
-#
-echo "PULLING RMR"
-cd /opt
-git clone "https://gerrit.o-ran-sc.org/r/ric-plt/lib/rmr"
-echo "START COMPILING RMR"
-cd /opt/rmr
-git checkout v1.0.31
-mkdir -p build
-cd build
-cmake ..
-make install
-
-echo "PULLING LOG"
-cd /opt
-git clone "https://gerrit.o-ran-sc.org/r/com/log"
-echo "START COMPILING LOG"
-cd /opt/log
-./autogen.sh
-./configure
-make install
-
-ldconfig
-
-echo "DOWNLOAD GO DEPENDENCIES"
-cd /opt/
-mkdir -p /opt/bin
-go get
-
-echo "START COMPILING COMPONENTS"
-go build -o /opt/bin/submgr ./cmd/submgr.go
-go build -o /opt/test/rco/rco ./test/rco/rco.go
-go build -o /opt/test/e2t/e2t ./test/e2t/e2t.go
-
-echo "SAVE RESULT"
-mkdir -p /opt/build/container/usr/local /opt/test/e2t/container/usr/local /opt/test/rco/container/usr/local
-cp -Rf /usr/local/lib /usr/local/include /opt/build/container/usr/local/
-cp -Rf /usr/local/lib /usr/local/include  /opt/test/e2t/container/usr/local/
-cp -Rf /usr/local/lib /usr/local/include  /opt/test/rco/container/usr/local/
-cp bin/submgr config/submgr.yaml /opt/build/container/
-
-echo "CLEANUP"
-rm -Rf /opt/rmr /opt/log /opt/go.sum
-
-echo "DONE"
diff --git a/build/container/Dockerfile b/build/container/Dockerfile
deleted file mode 100644 (file)
index 0dffd40..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-#
-#==================================================================================
-#   Copyright (c) 2019 AT&T Intellectual Property.
-#   Copyright (c) 2019 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.
-#==================================================================================
-#
-#
-#      Abstract:       Builds the Subscription Manager's production ready container image
-#      Date:           28 May 2019
-#
-
-FROM ubuntu
-
-COPY submgr /
-COPY submgr.yaml /
-COPY run_submgr.sh /
-COPY usr/ /usr/
-RUN ldconfig
\ No newline at end of file
diff --git a/container-tag.yaml b/container-tag.yaml
new file mode 100644 (file)
index 0000000..13e64f5
--- /dev/null
@@ -0,0 +1,5 @@
+# The Jenkins job requires a tag to build the Docker image.
+# By default this file is in the docker build directory,
+# but the location can configured in the JJB template.
+---
+tag: 0.1.1
index 9e282f8..70797bf 100644 (file)
@@ -37,7 +37,7 @@ spec:
     spec:
       containers:
       - name: submgr
-        image: cmaster:5000/submgr:0.1.0i
+        image: cmaster:5000/submgr:0.1.1
         command: ["/run_submgr.sh"]
         env:
         - name: DBAAS_SERVICE_HOST
diff --git a/pkg/control/libe2ap.a b/pkg/control/libe2ap.a
deleted file mode 100644 (file)
index 529a7ce..0000000
Binary files a/pkg/control/libe2ap.a and /dev/null differ
old mode 100644 (file)
new mode 100755 (executable)
similarity index 100%
rename from build/container/run_submgr.sh
rename to run_submgr.sh
old mode 100644 (file)
new mode 100755 (executable)
index d5406b7..07a7548
@@ -23,7 +23,5 @@
 #      Date:           28 May 2019
 #
 
-cp -Rf ${PWD}/e2t ${PWD}/e2t.yaml ${PWD}/container/
-
 echo 'Creating E2T container'
-docker build --no-cache --tag=e2t:builder ${PWD}/container/
+docker build --no-cache --tag=e2t:builder  -f container/Dockerfile  ../..
index f3a8c27..6540385 100644 (file)
 #      Date:           28 May 2019
 #
 
-FROM ubuntu
+FROM nexus3.o-ran-sc.org:10004/bldr-ubuntu18-c-go:1-u18.04-nng1.1.1 as submgrbuild
+
+# Install RMr shared library
+RUN wget --content-disposition https://packagecloud.io/o-ran-sc/master/packages/debian/stretch/rmr_1.0.36_amd64.deb/download.deb && dpkg -i rmr_1.0.36_amd64.deb
+# Install RMr development header files
+RUN wget --content-disposition https://packagecloud.io/o-ran-sc/master/packages/debian/stretch/rmr-dev_1.0.36_amd64.deb/download.deb && dpkg -i rmr-dev_1.0.36_amd64.deb
+
+# "PULLING LOG and COMPILING LOG"
+RUN git clone "https://gerrit.o-ran-sc.org/r/com/log" /opt/log && cd /opt/log && \
+ ./autogen.sh && ./configure && make install && ldconfig
+
+COPY . /opt/submgr
+RUN mkdir -p /opt/bin && cd /opt/submgr && \
+ /usr/local/go/bin/go get && \
+   /usr/local/go/bin/go build -o /opt/test/e2t/e2t ./test/e2t/e2t.go && \
+    mkdir -p /opt/test/e2t/container/usr/local
+
+FROM ubuntu:18.04
+
+COPY --from=submgrbuild /opt/test/e2t/e2t /
+COPY  test/e2t/e2t.yaml test/e2t/container/run_e2t.sh /
+COPY --from=submgrbuild /usr/local/include /usr/local/include
+COPY --from=submgrbuild /usr/local/lib /usr/local/lib
 
-COPY e2t /
-COPY e2t.yaml /
-COPY run_e2t.sh /
-COPY usr/ /usr/
 RUN ldconfig
\ No newline at end of file
diff --git a/test/e2t/container/e2t.yaml b/test/e2t/container/e2t.yaml
deleted file mode 100644 (file)
index e91fbdf..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-#   Copyright (c) 2019 AT&T Intellectual Property.
-#   Copyright (c) 2019 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.
-
-"local":
-  "host": ":8080"
-"logger":
-  "level": 4
-"rmr":
-  "protPort": "tcp:4560"
-  "maxSize": 2072
-  "numWorkers": 1
old mode 100644 (file)
new mode 100755 (executable)
old mode 100644 (file)
new mode 100755 (executable)
index a631d87..517a8a6
@@ -23,7 +23,5 @@
 #      Date:           28 May 2019
 #
 
-cp -Rf ${PWD}/rco ${PWD}/rco.yaml ${PWD}/container/
-
 echo 'Creating RCO container'
-docker build --no-cache --tag=rco:builder ${PWD}/container/
+docker build --no-cache --tag=rco:builder  -f container/Dockerfile  ../..
index 1ddf3c0..8945cec 100644 (file)
 #      Date:           28 May 2019
 #
 
-FROM ubuntu
+FROM nexus3.o-ran-sc.org:10004/bldr-ubuntu18-c-go:1-u18.04-nng1.1.1 as submgrbuild
+
+# Install RMr shared library
+RUN wget --content-disposition https://packagecloud.io/o-ran-sc/master/packages/debian/stretch/rmr_1.0.36_amd64.deb/download.deb && dpkg -i rmr_1.0.36_amd64.deb
+# Install RMr development header files
+RUN wget --content-disposition https://packagecloud.io/o-ran-sc/master/packages/debian/stretch/rmr-dev_1.0.36_amd64.deb/download.deb && dpkg -i rmr-dev_1.0.36_amd64.deb
+
+# "PULLING LOG and COMPILING LOG"
+RUN git clone "https://gerrit.o-ran-sc.org/r/com/log" /opt/log && cd /opt/log && \
+ ./autogen.sh && ./configure && make install && ldconfig
+
+COPY . /opt/submgr
+RUN mkdir -p /opt/bin && cd /opt/submgr && \
+ /usr/local/go/bin/go get && \
+   /usr/local/go/bin/go build -o /opt/test/rco/rco ./test/rco/rco.go && \
+    mkdir -p /opt/test/rco/container/usr/local
+
+FROM ubuntu:18.04
+
+COPY --from=submgrbuild /opt/test/rco/rco /
+COPY  test/rco/rco.yaml test/rco/container/run_rco.sh /
+COPY --from=submgrbuild /usr/local/include /usr/local/include
+COPY --from=submgrbuild /usr/local/lib /usr/local/lib
 
-COPY rco /
-COPY rco.yaml /
-COPY run_rco.sh /
-COPY usr/ /usr/
 RUN ldconfig
\ No newline at end of file
old mode 100644 (file)
new mode 100755 (executable)