X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=Dockerfile;h=c61aded4d3f1e4c5b29d31a51693dc413d71c7b1;hb=HEAD;hp=7ff0724cf3cf889cf2545eb9832667a3624f9109;hpb=66b7813221b6da5c15da40953d09d3846a4bc029;p=ric-plt%2Fvespamgr.git diff --git a/Dockerfile b/Dockerfile old mode 100644 new mode 100755 index 7ff0724..c61aded --- a/Dockerfile +++ b/Dockerfile @@ -13,9 +13,15 @@ # 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). +# + +FROM golang:1.16 as gobuild -# Start from golang v1.12 base image -FROM golang:1.12 as gobuild +# Install utilities +RUN apt update && apt install -y iputils-ping net-tools curl sudo # Set the Working Directory for ves-agent inside the container RUN mkdir -p $GOPATH/src/VESPA @@ -25,41 +31,39 @@ WORKDIR $GOPATH/src/VESPA RUN git clone -b v0.3.0 https://github.com/nokia/ONAP-VESPA.git $GOPATH/src/VESPA RUN GO111MODULE=on go mod download +ENV GOLANG_VERSION 1.16 +RUN wget --quiet https://dl.google.com/go/go$GOLANG_VERSION.linux-amd64.tar.gz \ + && tar xvzf go$GOLANG_VERSION.linux-amd64.tar.gz -C /usr/local # Install VES Agent RUN export GOPATH=$HOME/go && \ export PATH=$GOPATH/bin:$GOROOT/bin:$PATH && \ go install -v ./ves-agent -# Set the Working Directory for vesmgr inside the container -RUN mkdir -p $GOPATH/src/vesmgr -WORKDIR $GOPATH/src/vesmgr +# Set the Working Directory for vespamgr inside the container +RUN mkdir -p /go/src/vespamgr +RUN mkdir -p /cfg +COPY . /go/src/vespamgr +WORKDIR /go/src/vespamgr -# Copy vesmgr to the Working Directory -COPY $HOME/ . +RUN ./build_vesmgr.sh -RUN GO111MODULE=on go mod download - -# Run vesmgr UT -RUN export GOPATH=$HOME/go && \ - export PATH=$GOPATH/bin:$GOROOT/bin:$PATH && \ - go test ./... +# Final, executable and deployable container +FROM ubuntu:20.04 -# Install vesmgr -RUN export GOPATH=$HOME/go && \ - export PATH=$GOPATH/bin:$GOROOT/bin:$PATH && \ - go install -v ./cmd/vesmgr +RUN mkdir -p /etc/ves-agent -################# -# -# Second phase, copy compiled stuff to a runtime container +COPY --from=gobuild /usr/local/lib /usr/local/lib +COPY --from=gobuild /root/go/bin /root/go/bin +COPY --from=gobuild /root/go/bin/vespamgr /usr/local/bin/vesmgr +COPY --from=gobuild /root/go/bin/vespamgr /vespamgr +COPY --from=gobuild /go/src/vespamgr/config/* /cfg/ +COPY --from=gobuild /go/src/vespamgr/config/plt-counter.json /cfg/plt-counter.json +RUN ldconfig -# Ubuntu or something smaller? -FROM ubuntu:18.04 -# Create the configuration directory for ves agent -RUN mkdir -p /etc/ves-agent -COPY --from=gobuild root/go/bin /root/go/bin +ENV CFG_FILE=/cfg/config-file.json +ENV RMR_SEED_RT=/cfg/uta_rtg.rt ENV PATH="/root/go/bin:${PATH}" -ENTRYPOINT ["vesmgr"] +ENTRYPOINT ["/vespamgr"]