65a54a6e6b5e1327fdfc2efbade364757f6b733b
[ta/caas-danm.git] / docker-build / sriovdp / Dockerfile
1 # Copyright 2019 Nokia
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 ARG go_version
16 FROM golang:${go_version}-alpine3.9 as builder
17 MAINTAINER Ferenc Toth <ferenc.2.toth@nokia.com>
18
19 ARG SRIOVDP
20 ARG SRIOVDP_HASH=""
21
22 RUN apk add --no-cache gcc musl-dev git curl tar linux-headers \
23 && mkdir -p $GOPATH/src/github.com/intel/sriov-network-device-plugin \
24 && cd $GOPATH/src/github.com/intel \
25 && if [ -n "$SRIOVDP_HASH" ]; then \
26      git clone https://github.com/intel/sriov-network-device-plugin.git \
27 &&   cd sriov-network-device-plugin \
28 &&   git checkout $SRIOVDP_HASH; \
29    else \
30      curl -fsSL https://github.com/intel/sriov-network-device-plugin/archive/v${SRIOVDP}.tar.gz | tar xz --strip-components=1 -C sriov-network-device-plugin; \
31    fi \
32 && go install -a -ldflags '-extldflags "-static"' github.com/intel/sriov-network-device-plugin/cmd/sriovdp
33
34 FROM alpine:3.9
35 RUN apk add --no-cache hwdata-pci jq
36
37 COPY --from=builder /go/bin/sriovdp /usr/local/bin/
38 RUN chmod 700 /usr/local/bin/sriovdp
39
40 WORKDIR /
41 LABEL io.k8s.display-name="SRIOV Network Device Plugin"
42 ENTRYPOINT ["/usr/local/bin/sriovdp"]