blob: 62e1d142ea9d06a8d97dcefdebefc4a647478bea [file] [log] [blame]
Kent Hagermanda41d742020-01-07 14:55:56 -05001# Copyright 2020-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.
Matteo Scandolo5cb1cce2020-11-19 17:39:13 -080014ARG GOLANG_VERSION
15FROM golang:$GOLANG_VERSION-alpine as build
Kent Hagermanda41d742020-01-07 14:55:56 -050016
David K. Bainbridgee33a5bc2021-04-06 20:30:58 +000017RUN apk add --no-cache build-base=0.5-r2
Kent Hagermanda41d742020-01-07 14:55:56 -050018
19# download & compile this specific version of gocover-cobertura
20ARG GOCOVER_COBERTURA_VERSION
21RUN GO111MODULE=on CGO_ENABLED=0 go get -u -ldflags "-linkmode external -extldflags -static" github.com/t-yuki/gocover-cobertura@$GOCOVER_COBERTURA_VERSION
22
Matteo Scandolo5cb1cce2020-11-19 17:39:13 -080023FROM golang:$GOLANG_VERSION-alpine
Kent Hagermanda41d742020-01-07 14:55:56 -050024
25# copy gocover-cobertura
26COPY --from=build /go/bin/* /usr/local/bin/
27
28WORKDIR /app
29
Matteo Scandolo5cb1cce2020-11-19 17:39:13 -080030ENV GOPATH=/app
31
32RUN mkdir -m 777 /.cache /go/pkg
33
Kent Hagermanda41d742020-01-07 14:55:56 -050034# Label image
35ARG org_label_schema_version=unknown
36ARG org_label_schema_vcs_url=unknown
37ARG org_label_schema_vcs_ref=unknown
38ARG org_label_schema_build_date=unknown
39ARG org_opencord_vcs_commit_date=unknown
40ARG org_opencord_vcs_dirty=unknown
41ARG GOCOVER_COBERTURA_VERSION=unknown
42
43LABEL org.label-schema.schema-version=1.0 \
44 org.label-schema.name=voltha-protoc \
45 org.label-schema.version=$org_label_schema_version \
46 org.label-schema.vcs-url=$org_label_schema_vcs_url \
47 org.label-schema.vcs-ref=$org_label_schema_vcs_ref \
48 org.label-schema.build-date=$org_label_schema_build_date \
49 org.opencord.vcs-commit-date=$org_opencord_vcs_commit_date \
50 org.opencord.vcs-dirty=$org_opencord_vcs_dirty \
51 org.opencord.gocover-cobertura-version=$GOCOVER_COBERTURA_VERSION