X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=Dockerfile;h=7a73b0070efad45d93f4fb72df93ccd270322786;hb=refs%2Fchanges%2F72%2F10172%2F4;hp=49c61bee614c9179af98c1d33e902218381fe0b9;hpb=97fa0b1cffd453564fb07aef45322e4e7425312f;p=ric-app%2Fhw-go.git diff --git a/Dockerfile b/Dockerfile index 49c61be..7a73b00 100755 --- a/Dockerfile +++ b/Dockerfile @@ -16,53 +16,39 @@ # #---------------------------------------------------------- -FROM nexus3.o-ran-sc.org:10004/o-ran-sc/bldr-ubuntu18-c-go:9-u18.04 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-ubuntu20-c-go:1.0.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 ca-certificates -# 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