X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=Dockerfile;h=3ae82cac2e9903c9df3871d1f94fd34415ef4cdb;hb=3c8e1c5e95e8bed8d0b4ae2c1ff47833a5eaf738;hp=9c3c11ea78de7d0d16587427fa972e8390e30ae4;hpb=177ddb3c6ff2d5562f9d40df835c0b238663f39d;p=ric-app%2Fhw-go.git diff --git a/Dockerfile b/Dockerfile index 9c3c11e..3ae82ca 100755 --- a/Dockerfile +++ b/Dockerfile @@ -16,53 +16,39 @@ # #---------------------------------------------------------- -FROM nexus3.o-ran-sc.org:10004/o-ran-sc/bldr-ubuntu18-c-go:1.9.0 as xapp-base -RUN apt-get update -y \ - &&apt-get install -y \ - apt-utils \ - cmake \ - gawk \ - sudo \ - nano \ - jq \ - gettext-base \ - bison \ - flex \ - curl \ - tree +FROM nexus3.o-ran-sc.org:10002/o-ran-sc/bldr-ubuntu18-c-go:1.9.0 as build-hw-go -RUN curl -s https://packagecloud.io/install/repositories/o-ran-sc/master/script.deb.sh | bash +# Install utilities +RUN apt update && apt install -y iputils-ping net-tools curl sudo -# RMR -ARG RMRVERSION=4.2.2 -#RUN apt-get install -y rmr=${RMRVERSION} rmr-dev=${RMRVERSION} -RUN wget --content-disposition https://packagecloud.io/o-ran-sc/release/packages/debian/stretch/rmr_${RMRVERSION}_amd64.deb/download.deb && dpkg -i rmr_${RMRVERSION}_amd64.deb -RUN wget --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 -RUN rm -f rmr_${RMRVERSION}_amd64.deb rmr-dev_${RMRVERSION}_amd64.deb +# Install RMr shared library & development header files +RUN wget --content-disposition https://packagecloud.io/o-ran-sc/release/packages/debian/stretch/rmr_4.7.0_amd64.deb/download.deb && dpkg -i rmr_4.7.0_amd64.deb && rm -rf rmr_4.7.0_amd64.deb +RUN wget --content-disposition https://packagecloud.io/o-ran-sc/release/packages/debian/stretch/rmr-dev_4.7.0_amd64.deb/download.deb && dpkg -i rmr-dev_4.7.0_amd64.deb && rm -rf rmr-dev_4.7.0_amd64.deb -# -RUN ldconfig +# Install dependencies, compile and test the module +RUN mkdir -p /go/src/hw-go +COPY . /go/src/hw-go -# -ENV PATH="/usr/local/go/bin:${PATH}" +WORKDIR "/go/src/hw-go" -WORKDIR "/" -CMD ["/bin/bash"] +ENV GO111MODULE=on GO_ENABLED=0 GOOS=linux + +RUN go build -a -installsuffix cgo -o hw-go hwApp.go -#---------------------------------------------------------- -# -#---------------------------------------------------------- -FROM xapp-base as xapp-base-testbuild +# Final deployment container +FROM ubuntu:18.04 -RUN mkdir -p /ws -WORKDIR "/ws" +ENV CFG_FILE=config/config-file.json +ENV RMR_SEED_RT=config/uta_rtg.rt -COPY . /ws -# Module prepare (if go.mod/go.sum updated) -#COPY go.mod /ws -#COPY go.sum /ws -#RUN go mod download +RUN mkdir /config -#RUN go build hwApp.go +COPY --from=build-hw-go /go/src/hw-go/hw-go / +COPY --from=build-hw-go /go/src/hw-go/config/* /config/ +COPY --from=build-hw-go /usr/local/lib /usr/local/lib + +RUN ldconfig +RUN chmod 755 /hw-go +CMD /hw-go