Keita NISHIMOTO | ca4da5f | 2018-10-15 22:48:52 +0900 | [diff] [blame] | 1 | # Copyright 2018-present Open Networking Foundation |
Zack Williams | 86f8720 | 2018-10-05 10:36:32 -0700 | [diff] [blame] | 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 | # |
Keita NISHIMOTO | ca4da5f | 2018-10-15 22:48:52 +0900 | [diff] [blame] | 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
Zack Williams | 86f8720 | 2018-10-05 10:36:32 -0700 | [diff] [blame] | 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. |
| 14 | |
| 15 | # bbsim dockerfile |
| 16 | |
Keita NISHIMOTO | ca4da5f | 2018-10-15 22:48:52 +0900 | [diff] [blame] | 17 | # builder parent |
| 18 | FROM golang:1.10-stretch as builder |
Zack Williams | 86f8720 | 2018-10-05 10:36:32 -0700 | [diff] [blame] | 19 | |
Keita NISHIMOTO | ca4da5f | 2018-10-15 22:48:52 +0900 | [diff] [blame] | 20 | # install prereqs |
| 21 | ENV PROTOC_VERSION 3.6.1 |
| 22 | ENV PROTOC_SHA256SUM 6003de742ea3fcf703cfec1cd4a3380fd143081a2eb0e559065563496af27807 |
Zack Williams | 86f8720 | 2018-10-05 10:36:32 -0700 | [diff] [blame] | 23 | |
Keita NISHIMOTO | ca4da5f | 2018-10-15 22:48:52 +0900 | [diff] [blame] | 24 | RUN apt-get update \ |
| 25 | && apt-get install -y unzip libpcap-dev \ |
| 26 | && curl -L -o /tmp/protoc-${PROTOC_VERSION}-linux-x86_64.zip https://github.com/google/protobuf/releases/download/v${PROTOC_VERSION}/protoc-${PROTOC_VERSION}-linux-x86_64.zip \ |
| 27 | && echo "$PROTOC_SHA256SUM /tmp/protoc-${PROTOC_VERSION}-linux-x86_64.zip" | sha256sum -c - \ |
| 28 | && unzip /tmp/protoc-${PROTOC_VERSION}-linux-x86_64.zip -d /tmp/protoc3 \ |
| 29 | && mv /tmp/protoc3/bin/* /usr/local/bin/ \ |
| 30 | && mv /tmp/protoc3/include/* /usr/local/include/ \ |
| 31 | && go get -v github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway \ |
Keita NISHIMOTO | fa5a134 | 2019-01-29 14:16:51 +0900 | [diff] [blame] | 32 | && go get -v github.com/golang/protobuf/protoc-gen-go |
Zack Williams | 86f8720 | 2018-10-05 10:36:32 -0700 | [diff] [blame] | 33 | |
Keita NISHIMOTO | ca4da5f | 2018-10-15 22:48:52 +0900 | [diff] [blame] | 34 | # copy and build |
| 35 | WORKDIR /go/src/gerrit.opencord.org/voltha-bbsim |
| 36 | COPY . /go/src/gerrit.opencord.org/voltha-bbsim |
Zack Williams | 86f8720 | 2018-10-05 10:36:32 -0700 | [diff] [blame] | 37 | |
Keita NISHIMOTO | ca4da5f | 2018-10-15 22:48:52 +0900 | [diff] [blame] | 38 | RUN make bbsim |
Keita NISHIMOTO | 3b8b9c0 | 2018-10-09 09:40:01 +0900 | [diff] [blame] | 39 | |
Keita NISHIMOTO | ca4da5f | 2018-10-15 22:48:52 +0900 | [diff] [blame] | 40 | # runtime parent |
| 41 | FROM golang:1.10-stretch |
Keita NISHIMOTO | 3b8b9c0 | 2018-10-09 09:40:01 +0900 | [diff] [blame] | 42 | |
Keita NISHIMOTO | ca4da5f | 2018-10-15 22:48:52 +0900 | [diff] [blame] | 43 | # runtime prereqs |
| 44 | # the symlink on libpcap is because both alpine and debian come with 1.8.x, but |
| 45 | # debian symlinks it to 0.8 for historical reasons: |
| 46 | # https://packages.debian.org/stretch/libpcap0.8-dev |
| 47 | RUN apt-get update \ |
| 48 | && apt-get install -y libpcap-dev wpasupplicant isc-dhcp-server network-manager\ |
| 49 | && ln -s /usr/lib/libpcap.so.1.8.1 /usr/lib/libpcap.so.0.8 |
Keita NISHIMOTO | 3b8b9c0 | 2018-10-09 09:40:01 +0900 | [diff] [blame] | 50 | |
Keita NISHIMOTO | 3b8b9c0 | 2018-10-09 09:40:01 +0900 | [diff] [blame] | 51 | COPY ./config/wpa_supplicant.conf /etc/wpa_supplicant/ |
| 52 | COPY ./config/isc-dhcp-server /etc/default/ |
| 53 | COPY ./config/dhcpd.conf /etc/dhcp/ |
| 54 | RUN mv /usr/sbin/dhcpd /usr/local/bin/ \ |
Keita NISHIMOTO | ca4da5f | 2018-10-15 22:48:52 +0900 | [diff] [blame] | 55 | && mv /sbin/dhclient /usr/local/bin/ \ |
| 56 | && touch /var/lib/dhcp/dhcpd.leases |
Keita NISHIMOTO | 3b8b9c0 | 2018-10-09 09:40:01 +0900 | [diff] [blame] | 57 | |
Keita NISHIMOTO | ca4da5f | 2018-10-15 22:48:52 +0900 | [diff] [blame] | 58 | WORKDIR /app |
| 59 | COPY --from=builder /go/src/gerrit.opencord.org/voltha-bbsim/bbsim /app/bbsim |
Zack Williams | 86f8720 | 2018-10-05 10:36:32 -0700 | [diff] [blame] | 60 | |
Keita NISHIMOTO | ca4da5f | 2018-10-15 22:48:52 +0900 | [diff] [blame] | 61 | CMD [ '/app/bbsim' ] |