X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;ds=sidebyside;f=Dockerfile;h=bace8a89773987e3fe77a2778f806098536262b2;hb=refs%2Fchanges%2F34%2F5034%2F4;hp=027e37222b59f1d63e893e534e34000ad18fcf0b;hpb=34e4383c438f87023bc411d9b0baa4a828a7e306;p=ric-plt%2Fappmgr.git diff --git a/Dockerfile b/Dockerfile index 027e372..bace8a8 100755 --- a/Dockerfile +++ b/Dockerfile @@ -13,24 +13,25 @@ # See the License for the specific language governing permissions and # limitations under the License. -#---------------------------------------------------------- +#----------------------------------------------------------- -FROM nexus3.o-ran-sc.org:10004/bldr-ubuntu18-c-go:2-u18.04-nng AS appmgr-build +ARG HELMVERSION=v2.12.3 +FROM nexus3.o-ran-sc.org:10004/o-ran-sc/bldr-ubuntu18-c-go:9-u18.04 AS appmgr-build RUN apt-get update -y && apt-get install -y jq ENV PATH="/usr/local/go/bin:${PATH}" -ARG HELMVERSION=v2.12.3 +ARG HELMVERSION # Install helm -RUN wget -nv https://storage.googleapis.com/kubernetes-helm/helm-${HELMVERSION}-linux-amd64.tar.gz \ +RUN wget -nv https://get.helm.sh/helm-${HELMVERSION}-linux-amd64.tar.gz \ && tar -zxvf helm-${HELMVERSION}-linux-amd64.tar.gz \ && cp linux-amd64/helm /usr/local/bin/helm \ && rm -rf helm-${HELMVERSION}-linux-amd64.tar.gz \ && rm -rf linux-amd64 # Install kubectl from Docker Hub -COPY --from=lachlanevenson/k8s-kubectl:v1.10.3 /usr/local/bin/kubectl /usr/local/bin/kubectl +COPY --from=lachlanevenson/k8s-kubectl:v1.16.0 /usr/local/bin/kubectl /usr/local/bin/kubectl ENV GOPATH="/go" @@ -52,13 +53,18 @@ RUN GO111MODULE=on go mod download # build and test COPY . /go/src/ws +# Generate Swagger code RUN /go/bin/swagger generate server -f api/appmgr_rest_api.yaml --name AppManager -t pkg/ --exclude-main COPY . /go/src/ws -RUN make -C /go/src/ws go-build +# Build the code +RUN GO111MODULE=on GO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o /go/src/ws/cache/go/cmd/appmgr cmd/appmgr.go + +# Run unit tests +RUN GO111MODULE=on GO_ENABLED=0 GOOS=linux go test -p 1 -cover ./pkg/cm/ ./pkg/helm/ ./pkg/resthooks/ -RUN make -C /go/src/ws go-test-fmt +RUN gofmt -l $(find cmd/ pkg/ -name '*.go' -not -name '*_test.go') CMD ["/bin/bash"] @@ -79,6 +85,8 @@ COPY --from=appmgr-build /usr/local/bin/kubectl /usr/local/bin/kubectl RUN ldconfig +ARG HELMVERSION +ENV HELMVERSION=$HELMVERSION # # xApp Manager #