Abukar Mohamed | 97e8d9a | 2019-05-02 06:11:43 +0000 | [diff] [blame] | 1 | # Copyright (c) 2019 AT&T Intellectual Property. |
| 2 | # Copyright (c) 2019 Nokia. |
| 3 | # |
| 4 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | # you may not use this file except in compliance with the License. |
| 6 | # You may obtain a copy of the License at |
| 7 | # |
| 8 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | # |
| 10 | # Unless required by applicable law or agreed to in writing, software |
| 11 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | # See the License for the specific language governing permissions and |
| 14 | # limitations under the License. |
| 15 | |
| 16 | #---------------------------------------------------------- |
| 17 | # |
| 18 | #---------------------------------------------------------- |
Abukar Mohamed | 059775c | 2019-05-22 14:48:10 +0000 | [diff] [blame] | 19 | FROM ubuntu:16.04 as appmgr-xapp-base |
Abukar Mohamed | 97e8d9a | 2019-05-02 06:11:43 +0000 | [diff] [blame] | 20 | |
| 21 | RUN apt-get update -y && \ |
| 22 | apt-get install -y wget |
| 23 | |
| 24 | RUN sed -i -e "s,http://archive.ubuntu.com/ubuntu,$(wget -qO - mirrors.ubuntu.com/mirrors.txt | head -1)," /etc/apt/sources.list |
| 25 | RUN sed -i -e "s,http://security.ubuntu.com/ubuntu,$(wget -qO - mirrors.ubuntu.com/mirrors.txt | head -1)," /etc/apt/sources.list |
| 26 | |
| 27 | # |
| 28 | # packages |
| 29 | # |
| 30 | RUN apt-get update -y && \ |
Abukar Mohamed | d732b87 | 2019-06-13 12:48:35 +0000 | [diff] [blame] | 31 | apt-get upgrade -y && \ |
Abukar Mohamed | 97e8d9a | 2019-05-02 06:11:43 +0000 | [diff] [blame] | 32 | apt-get install -y \ |
| 33 | build-essential \ |
| 34 | apt-utils \ |
| 35 | cmake \ |
| 36 | make \ |
| 37 | autoconf \ |
| 38 | autoconf-archive \ |
| 39 | gawk \ |
| 40 | libtool \ |
| 41 | automake \ |
| 42 | pkg-config \ |
| 43 | sudo \ |
| 44 | wget \ |
| 45 | nano \ |
| 46 | git \ |
| 47 | jq |
| 48 | |
| 49 | |
| 50 | # |
| 51 | # go |
| 52 | # |
| 53 | RUN wget https://dl.google.com/go/go1.12.linux-amd64.tar.gz && \ |
| 54 | tar -C /usr/local -xvf ./go1.12.linux-amd64.tar.gz |
| 55 | |
| 56 | ENV PATH="/usr/local/go/bin:${PATH}" |
| 57 | |
Abukar Mohamed | 97e8d9a | 2019-05-02 06:11:43 +0000 | [diff] [blame] | 58 | COPY build/user_entrypoint.sh / |
| 59 | |
Abukar Mohamed | 97e8d9a | 2019-05-02 06:11:43 +0000 | [diff] [blame] | 60 | RUN chmod +x /user_entrypoint.sh |
| 61 | |
| 62 | RUN mkdir -p /ws |
| 63 | WORKDIR "/ws" |
| 64 | ENTRYPOINT ["/user_entrypoint.sh"] |
| 65 | CMD ["/bin/bash"] |
| 66 | |
| 67 | #---------------------------------------------------------- |
| 68 | # |
| 69 | #---------------------------------------------------------- |
Abukar Mohamed | 059775c | 2019-05-22 14:48:10 +0000 | [diff] [blame] | 70 | FROM appmgr-xapp-base as appmgr-build |
Abukar Mohamed | 97e8d9a | 2019-05-02 06:11:43 +0000 | [diff] [blame] | 71 | |
Mohamed Abukar | 9135751 | 2019-06-20 06:37:13 +0300 | [diff] [blame^] | 72 | ARG HELMVERSION=v2.13.0-rc.1 |
| 73 | ARG PACKAGEURL=gerrit.o-ran-sc.org/r/c/ric-plt/appmgr/ |
Abukar Mohamed | 97e8d9a | 2019-05-02 06:11:43 +0000 | [diff] [blame] | 74 | |
| 75 | # |
| 76 | # helm |
| 77 | # |
| 78 | RUN wget https://storage.googleapis.com/kubernetes-helm/helm-${HELMVERSION}-linux-amd64.tar.gz \ |
| 79 | && tar -zxvf helm-${HELMVERSION}-linux-amd64.tar.gz \ |
| 80 | && cp linux-amd64/helm /usr/bin/helm \ |
| 81 | && rm -rf helm-${HELMVERSION}-linux-amd64.tar.gz \ |
| 82 | && rm -rf linux-amd64 |
| 83 | |
| 84 | # Install kubectl from Docker Hub. |
| 85 | COPY --from=lachlanevenson/k8s-kubectl:v1.10.3 /usr/local/bin/kubectl /usr/local/bin/kubectl |
| 86 | |
| 87 | RUN mkdir -p /go/src/${PACKAGEURL} |
| 88 | WORKDIR "/go/src/${PACKAGEURL}" |
| 89 | ENV GOPATH="/go" |
| 90 | |
| 91 | # Module prepare (if go.mod/go.sum updated) |
| 92 | COPY go.mod /go/src/${PACKAGEURL} |
| 93 | COPY go.sum /go/src/${PACKAGEURL} |
Abukar Mohamed | 059775c | 2019-05-22 14:48:10 +0000 | [diff] [blame] | 94 | RUN GO111MODULE=on go mod download |
Abukar Mohamed | 97e8d9a | 2019-05-02 06:11:43 +0000 | [diff] [blame] | 95 | |
| 96 | # build |
| 97 | COPY . /go/src/${PACKAGEURL} |
Abukar Mohamed | 059775c | 2019-05-22 14:48:10 +0000 | [diff] [blame] | 98 | RUN make -C /go/src/${PACKAGEURL} build |
Abukar Mohamed | 97e8d9a | 2019-05-02 06:11:43 +0000 | [diff] [blame] | 99 | |
Abukar Mohamed | 97e8d9a | 2019-05-02 06:11:43 +0000 | [diff] [blame] | 100 | CMD ["/bin/bash"] |
| 101 | |
| 102 | |
| 103 | #---------------------------------------------------------- |
| 104 | # |
| 105 | #---------------------------------------------------------- |
| 106 | FROM appmgr-build as appmgr-test_unit |
Mohamed Abukar | 9135751 | 2019-06-20 06:37:13 +0300 | [diff] [blame^] | 107 | ARG PACKAGEURL=gerrit.o-ran-sc.org/r/c/ric-plt/appmgr/ |
Abukar Mohamed | 97e8d9a | 2019-05-02 06:11:43 +0000 | [diff] [blame] | 108 | WORKDIR "/go/src/${PACKAGEURL}" |
| 109 | CMD ["make","go-test"] |
| 110 | |
| 111 | |
| 112 | #---------------------------------------------------------- |
| 113 | # |
| 114 | #---------------------------------------------------------- |
| 115 | FROM appmgr-build as appmgr-test_fmt |
Mohamed Abukar | 9135751 | 2019-06-20 06:37:13 +0300 | [diff] [blame^] | 116 | ARG PACKAGEURL=gerrit.o-ran-sc.org/r/c/ric-plt/appmgr/ |
Abukar Mohamed | 97e8d9a | 2019-05-02 06:11:43 +0000 | [diff] [blame] | 117 | WORKDIR "/go/src/${PACKAGEURL}" |
| 118 | CMD ["make","go-test-fmt"] |
| 119 | |
| 120 | #---------------------------------------------------------- |
| 121 | # |
| 122 | #---------------------------------------------------------- |
| 123 | FROM appmgr-build as appmgr-test_sanity |
Mohamed Abukar | 9135751 | 2019-06-20 06:37:13 +0300 | [diff] [blame^] | 124 | ARG PACKAGEURL=gerrit.o-ran-sc.org/r/c/ric-plt/appmgr/ |
Abukar Mohamed | 97e8d9a | 2019-05-02 06:11:43 +0000 | [diff] [blame] | 125 | WORKDIR "/go/src/${PACKAGEURL}" |
| 126 | CMD ["jq","-s",".", "api/appmgr_rest_api.json"] |
| 127 | |
| 128 | |
| 129 | #---------------------------------------------------------- |
| 130 | # |
| 131 | #---------------------------------------------------------- |
| 132 | FROM ubuntu:16.04 as appmgr |
Mohamed Abukar | 9135751 | 2019-06-20 06:37:13 +0300 | [diff] [blame^] | 133 | ARG PACKAGEURL=gerrit.o-ran-sc.org/r/c/ric-plt/appmgr/ |
Abukar Mohamed | 97e8d9a | 2019-05-02 06:11:43 +0000 | [diff] [blame] | 134 | |
| 135 | RUN apt-get update -y \ |
| 136 | && apt-get install -y sudo openssl ca-certificates ca-cacert \ |
| 137 | && apt-get clean |
| 138 | |
| 139 | |
| 140 | # |
| 141 | # libraries and helm |
| 142 | # |
| 143 | COPY --from=appmgr-build /usr/local/include/ /usr/local/include/ |
| 144 | COPY --from=appmgr-build /usr/local/lib/ /usr/local/lib/ |
| 145 | COPY --from=appmgr-build /usr/bin/helm /usr/bin/helm |
| 146 | COPY --from=appmgr-build /usr/local/bin/kubectl /usr/bin/kubectl |
| 147 | |
| 148 | RUN ldconfig |
| 149 | |
| 150 | # |
| 151 | # xApp |
| 152 | # |
| 153 | RUN mkdir -p /opt/xAppManager \ |
| 154 | && chmod -R 755 /opt/xAppManager |
| 155 | |
Abukar Mohamed | 059775c | 2019-05-22 14:48:10 +0000 | [diff] [blame] | 156 | COPY --from=appmgr-build /go/src/${PACKAGEURL}/cache/go/cmd/appmgr /opt/xAppManager/appmgr |
Abukar Mohamed | 97e8d9a | 2019-05-02 06:11:43 +0000 | [diff] [blame] | 157 | #COPY --from=appmgr-build /go/src/${PACKAGEURL}/config/appmgr.yaml /opt/etc/xAppManager/config-file.yaml |
| 158 | |
| 159 | |
| 160 | WORKDIR /opt/xAppManager |
| 161 | |
| 162 | COPY appmgr-entrypoint.sh /opt/xAppManager/ |
| 163 | ENTRYPOINT ["/opt/xAppManager/appmgr-entrypoint.sh"] |