1 # Copyright (c) 2019 AT&T Intellectual Property.
2 # Copyright (c) 2019 Nokia.
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
8 # http://www.apache.org/licenses/LICENSE-2.0
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.
16 #----------------------------------------------------------
18 #----------------------------------------------------------
19 FROM ubuntu:16.04 as xapp-base
21 RUN apt-get update -y && \
22 apt-get install -y wget
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
30 RUN apt-get update -y && \
31 apt-get upgrade -y && \
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
56 ENV PATH="/usr/local/go/bin:${PATH}"
61 RUN mkdir -p /opt/build \
62 && cd /opt/build && git clone https://gerrit.oran-osc.org/r/com/log \
63 && cd log/ ; ./autogen.sh ; ./configure ; make ; make install \
66 COPY build/build_entrypoint.sh /
67 COPY build/user_entrypoint.sh /
69 RUN chmod +x /build_entrypoint.sh
70 RUN chmod +x /user_entrypoint.sh
74 ENTRYPOINT ["/user_entrypoint.sh"]
77 #----------------------------------------------------------
79 #----------------------------------------------------------
80 FROM xapp-base as appmgr-build
92 RUN wget https://storage.googleapis.com/kubernetes-helm/helm-${HELMVERSION}-linux-amd64.tar.gz \
93 && tar -zxvf helm-${HELMVERSION}-linux-amd64.tar.gz \
94 && cp linux-amd64/helm /usr/bin/helm \
95 && rm -rf helm-${HELMVERSION}-linux-amd64.tar.gz \
98 # Install kubectl from Docker Hub.
99 COPY --from=lachlanevenson/k8s-kubectl:v1.10.3 /usr/local/bin/kubectl /usr/local/bin/kubectl
101 RUN mkdir -p /go/src/${PACKAGEURL}
102 WORKDIR "/go/src/${PACKAGEURL}"
105 # Module prepare (if go.mod/go.sum updated)
106 COPY go.mod /go/src/${PACKAGEURL}
107 COPY go.sum /go/src/${PACKAGEURL}
108 RUN GO111MODULE=on /build_entrypoint.sh go mod download
111 COPY . /go/src/${PACKAGEURL}
112 RUN /build_entrypoint.sh make -C /go/src/${PACKAGEURL} build
114 ENTRYPOINT ["/build_entrypoint.sh"]
118 #----------------------------------------------------------
120 #----------------------------------------------------------
121 FROM appmgr-build as appmgr-test_unit
123 WORKDIR "/go/src/${PACKAGEURL}"
124 CMD ["make","go-test"]
127 #----------------------------------------------------------
129 #----------------------------------------------------------
130 FROM appmgr-build as appmgr-test_fmt
132 WORKDIR "/go/src/${PACKAGEURL}"
133 CMD ["make","go-test-fmt"]
135 #----------------------------------------------------------
137 #----------------------------------------------------------
138 FROM appmgr-build as appmgr-test_sanity
140 WORKDIR "/go/src/${PACKAGEURL}"
141 CMD ["jq","-s",".", "api/appmgr_rest_api.json"]
144 #----------------------------------------------------------
146 #----------------------------------------------------------
147 FROM ubuntu:16.04 as appmgr
150 RUN apt-get update -y \
151 && apt-get install -y sudo openssl ca-certificates ca-cacert \
158 COPY --from=appmgr-build /usr/local/include/ /usr/local/include/
159 COPY --from=appmgr-build /usr/local/lib/ /usr/local/lib/
160 COPY --from=appmgr-build /usr/bin/helm /usr/bin/helm
161 COPY --from=appmgr-build /usr/local/bin/kubectl /usr/bin/kubectl
168 RUN mkdir -p /opt/xAppManager \
169 && chmod -R 755 /opt/xAppManager
171 COPY --from=appmgr-build /go/src/${PACKAGEURL}/build/cache/cmd/appmgr /opt/xAppManager/appmgr
172 #COPY --from=appmgr-build /go/src/${PACKAGEURL}/config/appmgr.yaml /opt/etc/xAppManager/config-file.yaml
175 WORKDIR /opt/xAppManager
177 COPY appmgr-entrypoint.sh /opt/xAppManager/
178 ENTRYPOINT ["/opt/xAppManager/appmgr-entrypoint.sh"]