blob: 1d7180f80002253c9fa45c09038b509f285b54c1 [file] [log] [blame]
Girish Gowdra64503432020-01-07 10:59:10 +05301# 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 Gowdra390f12f2021-07-01 15:53:49 -070018FROM golang:1.16.3-alpine3.13 AS build-env
Girish Gowdra64503432020-01-07 10:59:10 +053019
20# Install required packages
Girish Gowdra390f12f2021-07-01 15:53:49 -070021RUN apk add --no-cache build-base=0.5-r2
Girish Gowdra64503432020-01-07 10:59:10 +053022
23# Prepare directory structure
Girish Gowdraaeceb842020-08-21 12:10:39 -070024WORKDIR /go/src/github.com/opencord/openolt-scale-tester
Girish Gowdra64503432020-01-07 10:59:10 +053025COPY . .
26
27# Build openolt
28SHELL ["/bin/ash", "-o", "pipefail", "-c"]
29ENV GO111MODULE=on
Girish Gowdraaeceb842020-08-21 12:10:39 -070030RUN go build -mod=vendor -o /go/bin/openolt-scale-tester
Girish Gowdra64503432020-01-07 10:59:10 +053031
32# -------------
33# Image creation stage
34
Girish Gowdra390f12f2021-07-01 15:53:49 -070035FROM alpine:3.13.6
Girish Gowdra64503432020-01-07 10:59:10 +053036
37# Set the working directory
38WORKDIR /app
39
40# Copy required files
41COPY --from=build-env /go/bin/openolt-scale-tester /app/
Girish Gowdraaeceb842020-08-21 12:10:39 -070042COPY --from=build-env /go/src/github.com/opencord/openolt-scale-tester/tech-profiles /app/