Girish Gowdra | 6450343 | 2020-01-07 10:59:10 +0530 | [diff] [blame] | 1 | # Copyright 2016 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. |
| 14 | |
| 15 | # ------------- |
| 16 | # Build stage |
| 17 | |
| 18 | FROM golang:1.12-alpine3.9 AS build-env |
| 19 | |
| 20 | # Install required packages |
| 21 | RUN apk add --no-cache wget git make build-base protobuf protobuf-dev |
| 22 | |
| 23 | # Prepare directory structure |
| 24 | WORKDIR /go/src |
| 25 | COPY . . |
| 26 | |
| 27 | # Build openolt |
| 28 | SHELL ["/bin/ash", "-o", "pipefail", "-c"] |
| 29 | ENV GO111MODULE=on |
Girish Gowdra | 5544479 | 2020-03-26 13:43:18 -0700 | [diff] [blame^] | 30 | RUN go mod vendor && go build -mod=vendor && go build -mod=vendor -o /go/bin/openolt-scale-tester |
Girish Gowdra | 6450343 | 2020-01-07 10:59:10 +0530 | [diff] [blame] | 31 | |
| 32 | # ------------- |
| 33 | # Image creation stage |
| 34 | |
| 35 | FROM alpine:3.9.4 |
| 36 | |
| 37 | # Set the working directory |
| 38 | WORKDIR /app |
| 39 | |
| 40 | # Copy required files |
| 41 | COPY --from=build-env /go/bin/openolt-scale-tester /app/ |
| 42 | COPY --from=build-env /go/src/tech-profiles /app/ |