blob: 6a767cf4170b86caf217860dd127f48eb1ce532a [file] [log] [blame]
Stephane Barbarie14088962017-06-01 16:56:55 -04001# Copyright 2017 the original author or authors.
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
Stephane Barbarie14088962017-06-01 16:56:55 -040014
15FROM centos:7
16
Kim Kempf01e23a82018-02-09 14:23:50 -080017MAINTAINER Voltha Community <info@opennetworking.org>
Stephane Barbarie14088962017-06-01 16:56:55 -040018
19# install required packages
20RUN ["yum", "install", "-y", "epel-release"]
21RUN ["yum", "install", "-y", "git", "make", "libtool", "libxml2-devel", "file", "libxslt-devel", "libssh-devel", "libcurl-devel", "python-pip", "libxml2-python", "openssh-server", "augeas-devel", "readline", "readline-devel", "openssl", "openssl-perl", "openssl-devel", "m2crypto", "which", "unzip", "gcc-c++", "gflags-devel", "gtest-devel", "clang", "c++-devel", "wget"]
22RUN ["ssh-keygen", "-A"]
23RUN ["pip", "install", "pyang"]
24RUN ["yum", "clean", "packages"]
25RUN ["yum", "clean", "headers"]
26
27# clone, build and install libnetconf
28RUN set -e -x; \
29 git clone https://github.com/CESNET/libnetconf.git /usr/src/libnetconf; \
30 cd /usr/src/libnetconf; \
31 ./configure --enable-tls --prefix='/usr'; \
32 make; \
33 make install; \
34 ln -s /usr/lib/pkgconfig/libnetconf.pc /usr/lib64/pkgconfig/; \
35 make clean;
36
37# clone netopeer
38RUN set -e -x; \
39 git clone https://github.com/CESNET/netopeer.git /usr/src/netopeer;
40
41# build and install netopeer-cli
42RUN set -e -x; \
43 cd /usr/src/netopeer/cli; \
44 ./configure --enable-tls --prefix='/usr'; \
45 make; \
46 make install; \
47 make clean;
48
49# build and install netopeer-server
50RUN set -e -x; \
51 cd /usr/src/netopeer/server; \
52 ./configure --enable-tls --prefix='/usr'; \
53 make; \
54 make install; \
55 cp -v config/datastore.xml /usr/etc/netopeer/cfgnetopeer/datastore.xml; \
56 make clean;
57
58# clone, build and install protobuf
59RUN set -e -x; \
60 git clone -b v3.2.1 https://github.com/google/protobuf.git /usr/src/protobuf; \
61 cd /usr/src/protobuf; \
62 ./autogen.sh; \
63 ./configure; \
64 make; \
65 make install; \
66 ldconfig; \
67 make clean;
68
69# Install golang
70RUN set -e -x; \
71 cd /tmp; \
72 wget https://storage.googleapis.com/golang/go1.8.1.linux-amd64.tar.gz; \
73 tar -C /usr/local -xzf /tmp/go1.8.1.linux-amd64.tar.gz; \
74 rm -f /tmp/go1.8.1.linux-amd64.tar.gz
75
76# Setup necessary environment variables
77ENV GOROOT /usr/local/go
78ENV PATH $PATH:$GOROOT/bin
79
80RUN ["mkdir", "/usr/local/share/go"]
81ENV GOPATH /usr/local/share/go
82ENV PATH $PATH:$GOPATH/bin
83
84# Install golang protobuf/grpc libraries
85RUN set -e -x; \
86 go get -u github.com/golang/protobuf/{proto,protoc-gen-go}; \
87 go get -u google.golang.org/grpc; \
88 go get -u github.com/hashicorp/consul/api;
89
90# Build and Install the golang Voltha GRPC client layer
91COPY netopeer/voltha-grpc-client /usr/src/voltha-grpc-client
92RUN set -e -x; \
93 mkdir -p /usr/local/share/go/src/github.com/opencord/voltha/netconf; \
94 ln -s /usr/src/voltha-grpc-client /usr/local/share/go/src/github.com/opencord/voltha/netconf/translator; \
95 cd /usr/src/voltha-grpc-client; \
96 go build -buildmode=c-shared -o voltha.so voltha.go; \
97 mv voltha.so /usr/lib64; \
98 mv voltha.h /usr/include; \
99 cp voltha-defs.h /usr/include; \
100 rm -f /usr/lib64/libvoltha.so; \
101 ln -s /usr/lib64/voltha.so /usr/lib64/libvoltha.so;
102
103# ------------------------------------------------
104# Sample transapi implementation
105#
106# To demonstrate the integration with the netopeer netconf server
107#
108
109# Build and Install the golang Voltha model conversion package
110COPY netopeer/voltha-netconf-model /usr/src/voltha-netconf-model
111RUN set -e -x; \
112 cd /usr/src/voltha-netconf-model; \
113 go build -buildmode=c-shared -o voltha-netconf-model.so netconf-model.go; \
114 mv voltha-netconf-model.so /usr/lib64; \
115 mv voltha-netconf-model.h /usr/include; \
116 rm -f /usr/lib64/libvoltha-netconf-model.so; \
117 ln -s /usr/lib64/voltha-netconf-model.so /usr/lib64/libvoltha-netconf-model.so;
118
119# Build and install the Voltha netconf transapi library
120COPY netopeer/voltha-transapi /usr/src/netopeer/voltha-transapi
121RUN set -e -x; \
122 cd /usr/src/netopeer/voltha-transapi; \
123 autoreconf --install; \
124 ./configure --prefix='/usr'; \
125 make; \
126 make install;
127
128# Finally start the netopeer-server with debugging logs enabled
129CMD ["/usr/bin/netopeer-server", "-v", "3"]
130
131# Expose the default netconf port
132EXPOSE 830