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 | |
Girish Gowdra | 390f12f | 2021-07-01 15:53:49 -0700 | [diff] [blame^] | 18 | FROM golang:1.16.3-alpine3.13 AS build-env |
Girish Gowdra | 6450343 | 2020-01-07 10:59:10 +0530 | [diff] [blame] | 19 | |
| 20 | # Install required packages |
Girish Gowdra | 390f12f | 2021-07-01 15:53:49 -0700 | [diff] [blame^] | 21 | RUN apk add --no-cache build-base=0.5-r2 |
Girish Gowdra | 6450343 | 2020-01-07 10:59:10 +0530 | [diff] [blame] | 22 | |
| 23 | # Prepare directory structure |
Girish Gowdra | aeceb84 | 2020-08-21 12:10:39 -0700 | [diff] [blame] | 24 | WORKDIR /go/src/github.com/opencord/openolt-scale-tester |
Girish Gowdra | 6450343 | 2020-01-07 10:59:10 +0530 | [diff] [blame] | 25 | COPY . . |
| 26 | |
| 27 | # Build openolt |
| 28 | SHELL ["/bin/ash", "-o", "pipefail", "-c"] |
| 29 | ENV GO111MODULE=on |
Girish Gowdra | aeceb84 | 2020-08-21 12:10:39 -0700 | [diff] [blame] | 30 | RUN 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 | |
Girish Gowdra | 390f12f | 2021-07-01 15:53:49 -0700 | [diff] [blame^] | 35 | FROM alpine:3.13.6 |
Girish Gowdra | 6450343 | 2020-01-07 10:59:10 +0530 | [diff] [blame] | 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/ |
Girish Gowdra | aeceb84 | 2020-08-21 12:10:39 -0700 | [diff] [blame] | 42 | COPY --from=build-env /go/src/github.com/opencord/openolt-scale-tester/tech-profiles /app/ |