Zack Williams | 34cd8f9 | 2018-09-14 16:04:19 -0700 | [diff] [blame] | 1 | # Copyright 2018-present Open Networking Foundation |
| 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. |
| 14 | |
| 15 | # Abstract OLT dockerfile |
| 16 | |
| 17 | # builder parent |
| 18 | FROM golang:1.10-stretch as builder |
| 19 | |
| 20 | # install prereqs |
| 21 | ENV PROTOC_VERSION 3.6.1 |
| 22 | ENV PROTOC_SHA256SUM 6003de742ea3fcf703cfec1cd4a3380fd143081a2eb0e559065563496af27807 |
| 23 | |
| 24 | RUN apt-get update \ |
| 25 | && apt-get install unzip \ |
| 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 \ |
| 32 | && go get -v github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger \ |
| 33 | && go get -v github.com/golang/protobuf/protoc-gen-go |
| 34 | |
| 35 | # copy and build |
| 36 | WORKDIR /go/src/gerrit.opencord.org/abstract-olt |
| 37 | COPY . /go/src/gerrit.opencord.org/abstract-olt |
| 38 | |
| 39 | RUN make all |
| 40 | |
| 41 | # runtime parent |
| 42 | FROM alpine:3.8 |
| 43 | |
| 44 | # required for binaries to run |
| 45 | RUN apk add --update libc6-compat |
| 46 | |
| 47 | WORKDIR /app |
| 48 | COPY --from=builder /go/src/gerrit.opencord.org/abstract-olt/bin/AbstractOLT /app/AbstractOLT |
| 49 | COPY --from=builder /go/src/gerrit.opencord.org/abstract-olt/bin/client /app/client |
Andy Bavier | cced3ff | 2018-10-03 10:06:52 -0700 | [diff] [blame^] | 50 | RUN mkdir -p /app/backup |
Zack Williams | 34cd8f9 | 2018-09-14 16:04:19 -0700 | [diff] [blame] | 51 | |
| 52 | EXPOSE 7777/tcp |
| 53 | EXPOSE 7778/tcp |
| 54 | |
| 55 | CMD [ '/app/AbstractOLT' ] |