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 ubuntubase
21 RUN apt-get update -y && \
22 apt-get install -y wget
25 RUN sed -i -e "s,http://archive.ubuntu.com/ubuntu,$(wget -qO - mirrors.ubuntu.com/mirrors.txt | head -1)," /etc/apt/sources.list
26 RUN sed -i -e "s,http://security.ubuntu.com/ubuntu,$(wget -qO - mirrors.ubuntu.com/mirrors.txt | head -1)," /etc/apt/sources.list
31 RUN apt-get update -y && \
32 apt-get upgrade -y && \
54 RUN wget https://dl.google.com/go/go1.12.linux-amd64.tar.gz && \
55 tar -C /usr/local -xvf ./go1.12.linux-amd64.tar.gz
57 ENV PATH="/usr/local/go/bin:${PATH}"
62 RUN mkdir -p /opt/build \
63 && cd /opt/build && git clone https://gerrit.oran-osc.org/r/com/log \
64 && cd log/ ; ./autogen.sh ; ./configure ; make ; make install \
67 #----------------------------------------------------------
69 #----------------------------------------------------------
70 FROM ubuntubase as builder
72 ARG PACKAGEURL=gerrit.oran-osc.org/r/ric-plt/appmgr
73 ARG HELMVERSION=v2.13.0-rc.1
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 \
88 RUN mkdir -p /go/src/${PACKAGEURL}
92 # Speed up things by generating layer with needed go packages
94 RUN go get github.com/gorilla/mux \
95 && go get github.com/spf13/viper \
96 && go get github.com/gorilla/mux \
97 && go get github.com/orcaman/concurrent-map \
98 && go get github.com/segmentio/ksuid \
99 && go get gopkg.in/yaml.v2
102 COPY . /go/src/${PACKAGEURL}
108 RUN make -C /go/src/${PACKAGEURL} build
111 #----------------------------------------------------------
113 #----------------------------------------------------------
114 FROM builder as test_unit
115 ARG PACKAGEURL=gerrit.oran-osc.org/r/ric-plt/appmgr
116 WORKDIR "/go/src/${PACKAGEURL}"
120 #----------------------------------------------------------
122 #----------------------------------------------------------
123 FROM builder as test_fmt
124 ARG PACKAGEURL=gerrit.oran-osc.org/r/ric-plt/appmgr
125 WORKDIR "/go/src/${PACKAGEURL}"
126 CMD ["make","test-fmt"]
128 #----------------------------------------------------------
130 #----------------------------------------------------------
131 FROM builder as test_sanity
132 ARG PACKAGEURL=gerrit.oran-osc.org/r/ric-plt/appmgr
133 WORKDIR "/go/src/${PACKAGEURL}"
134 CMD ["jq","-s",".", "api/appmgr_rest_api.json"]
137 #----------------------------------------------------------
139 #----------------------------------------------------------
140 FROM ubuntu:16.04 as release
141 ARG PACKAGEURL=gerrit.oran-osc.org/r/ric-plt/appmgr
143 RUN apt-get update -y \
144 && apt-get install -y sudo openssl ca-certificates ca-cacert \
151 COPY --from=builder /usr/local/include/ /usr/local/include/
152 COPY --from=builder /usr/local/lib/ /usr/local/lib/
153 COPY --from=builder /usr/bin/helm /usr/bin/helm
160 RUN mkdir -p /opt/xAppManager \
161 && chmod -R 755 /opt/xAppManager
163 COPY --from=builder /go/src/${PACKAGEURL}/build/appmgr /opt/xAppManager/appmgr
164 #COPY --from=builder /go/src/${PACKAGEURL}/config/appmgr.yaml /opt/etc/xAppManager/config-file.yaml
167 COPY docker/docker-entrypoint.sh /opt/xAppManager/
169 WORKDIR /opt/xAppManager
171 ENTRYPOINT ["/opt/xAppManager/docker-entrypoint.sh"]