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
24 #RUN sed -i -e 's,http://archive.ubuntu.com/ubuntu,mirror://mirrors.ubuntu.com/mirrors.txt,' /etc/apt/sources.list
25 #RUN sed -i -e 's,http://security.ubuntu.com/ubuntu,mirror://mirrors.ubuntu.com/mirrors.txt,' /etc/apt/sources.list
26 #RUN sed -i -e 's,http://archive.ubuntu.com/ubuntu,http://mirrors.nic.funet.fi/ubuntu,' /etc/apt/sources.list
27 #RUN sed -i -e 's,http://security.ubuntu.com/ubuntu,http://mirrors.nic.funet.fi/ubuntu,' /etc/apt/sources.list
29 RUN sed -i -e "s,http://archive.ubuntu.com/ubuntu,$(wget -qO - mirrors.ubuntu.com/mirrors.txt | head -1)," /etc/apt/sources.list
30 RUN sed -i -e "s,http://security.ubuntu.com/ubuntu,$(wget -qO - mirrors.ubuntu.com/mirrors.txt | head -1)," /etc/apt/sources.list
35 RUN apt-get update -y && \
36 apt-get upgrade -y && \
58 RUN wget https://dl.google.com/go/go1.12.linux-amd64.tar.gz && \
59 tar -C /usr/local -xvf ./go1.12.linux-amd64.tar.gz
61 ENV PATH="/usr/local/go/bin:${PATH}"
66 RUN mkdir -p /opt/build \
67 && cd /opt/build && git clone https://gerrit.oran-osc.org/r/com/log \
68 && cd log/ ; ./autogen.sh ; ./configure ; make ; make install \
72 #----------------------------------------------------------
74 #----------------------------------------------------------
75 FROM ubuntubase as builder
82 RUN wget https://storage.googleapis.com/kubernetes-helm/helm-${HELMVERSION}-linux-amd64.tar.gz \
83 && tar -zxvf helm-${HELMVERSION}-linux-amd64.tar.gz \
84 && cp linux-amd64/helm /usr/bin/helm \
85 && rm -rf helm-${HELMVERSION}-linux-amd64.tar.gz \
92 RUN mkdir -p /go/src/appmgr
96 # Speed up things by generating layer with needed go packages
98 RUN go get github.com/gorilla/mux \
99 && go get github.com/spf13/viper \
100 && go get github.com/gorilla/mux \
101 && go get github.com/orcaman/concurrent-map \
102 && go get github.com/segmentio/ksuid \
103 && go get gopkg.in/yaml.v2
106 COPY . /go/src/appmgr
112 RUN make -C /go/src/appmgr/build deps
114 RUN make -C /go/src/appmgr/build build
117 #----------------------------------------------------------
119 #----------------------------------------------------------
120 FROM builder as test_unit
121 WORKDIR "/go/src/appmgr"
122 CMD ["make","-C","build", "unit-test"]
125 #----------------------------------------------------------
127 #----------------------------------------------------------
128 FROM builder as test_sanity
129 WORKDIR "/go/src/appmgr"
130 CMD ["jq","-s",".", "rest_api/xapp_manager_rest_api.json"]
132 #----------------------------------------------------------
134 #----------------------------------------------------------
135 FROM ubuntu:16.04 as release
137 RUN apt-get update -y \
138 && apt-get install -y sudo openssl ca-certificates ca-cacert \
145 COPY --from=builder /usr/local/include/ /usr/local/include/
146 COPY --from=builder /usr/local/lib/ /usr/local/lib/
147 COPY --from=builder /usr/bin/helm /usr/bin/helm
154 RUN mkdir -p /opt/xAppManager \
155 && chmod -R 755 /opt/xAppManager
157 COPY --from=builder /go/src/appmgr/build/appmgr /opt/xAppManager/appmgr
158 #COPY --from=builder /go/src/appmgr/config/appmgr.yaml /opt/etc/xAppManager/config-file.yaml
161 COPY build/docker-entrypoint.sh /opt/xAppManager/
163 WORKDIR /opt/xAppManager
165 ENTRYPOINT ["/opt/xAppManager/docker-entrypoint.sh"]