From: kalnagy Date: Fri, 28 Jun 2019 13:28:35 +0000 (+0200) Subject: Initial version of the unified Dockerfile X-Git-Tag: 0.10.7~13 X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=commitdiff_plain;ds=sidebyside;h=303e57cbddf5d0d5e77e2bf7ec60643fcf525419;p=ric-plt%2Fsubmgr.git Initial version of the unified Dockerfile Change-Id: I6cd63cdabf005cd3faa512059373f553de975012 Signed-off-by: kalnagy --- diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..0cfc320 --- /dev/null +++ b/Dockerfile @@ -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 diff --git a/README.md b/README.md index 361baf2..fa66227 100644 --- 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 diff --git a/RELNOTES b/RELNOTES index 99d79ef..f9df805 100644 --- 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 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 index 6a5f2a1..0000000 --- a/build/binary/Dockerfile +++ /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 index 592f806..0000000 --- a/build/binary/compile.sh +++ /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 index 0dffd40..0000000 --- a/build/container/Dockerfile +++ /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 index 0000000..13e64f5 --- /dev/null +++ b/container-tag.yaml @@ -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 diff --git a/manifests/submgr/submgr-dep.yaml b/manifests/submgr/submgr-dep.yaml index 9e282f8..70797bf 100644 --- a/manifests/submgr/submgr-dep.yaml +++ b/manifests/submgr/submgr-dep.yaml @@ -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 index 529a7ce..0000000 Binary files a/pkg/control/libe2ap.a and /dev/null differ diff --git a/build/container/run_submgr.sh b/run_submgr.sh old mode 100644 new mode 100755 similarity index 100% rename from build/container/run_submgr.sh rename to run_submgr.sh diff --git a/test/e2t/build.sh b/test/e2t/build.sh old mode 100644 new mode 100755 index d5406b7..07a7548 --- a/test/e2t/build.sh +++ b/test/e2t/build.sh @@ -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 ../.. diff --git a/test/e2t/container/Dockerfile b/test/e2t/container/Dockerfile index f3a8c27..6540385 100644 --- a/test/e2t/container/Dockerfile +++ b/test/e2t/container/Dockerfile @@ -21,10 +21,28 @@ # 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 index e91fbdf..0000000 --- a/test/e2t/container/e2t.yaml +++ /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 diff --git a/test/e2t/container/run_e2t.sh b/test/e2t/container/run_e2t.sh old mode 100644 new mode 100755 diff --git a/test/rco/build.sh b/test/rco/build.sh old mode 100644 new mode 100755 index a631d87..517a8a6 --- a/test/rco/build.sh +++ b/test/rco/build.sh @@ -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 ../.. diff --git a/test/rco/container/Dockerfile b/test/rco/container/Dockerfile index 1ddf3c0..8945cec 100644 --- a/test/rco/container/Dockerfile +++ b/test/rco/container/Dockerfile @@ -21,10 +21,28 @@ # 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 diff --git a/test/rco/container/run_rco.sh b/test/rco/container/run_rco.sh old mode 100644 new mode 100755