554c38926771264f6633b92fbab273d7287cf170
[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 FROM alpine:3.9
16 MAINTAINER Levente Kale <levente.kale@nokia.com>
17
18 ARG SRIOVDP
19 ENV SRIOVDP_VERSION=$SRIOVDP
20 ENV GOPATH /go
21 ARG go_install_dir="/usr/local/go"
22 ARG go_version
23 ENV PATH $GOPATH/bin:$go_install_dir/bin:/usr/local/go/bin:$PATH
24 ENV GOOS=linux
25
26 WORKDIR /
27
28 RUN apk add --no-cache jq \
29 && apk add --no-cache --virtual .tools ca-certificates gcc musl-dev go glide git bash curl tar \
30 && mkdir -p $go_install_dir \
31 && curl -fsSL -k https://dl.google.com/go/go${go_version}.src.tar.gz | tar zx --strip-components=1 -C ${go_install_dir} \
32 && cd ${go_install_dir}/src/ \
33 && ./make.bash \
34 && mkdir -p $GOPATH/src/github.com/intel \
35 && git clone https://github.com/intel/sriov-network-device-plugin.git $GOPATH/src/github.com/intel/sriov-network-device-plugin --branch=v${SRIOVDP_VERSION} \
36 && cd $GOPATH/src/github.com/intel/sriov-network-device-plugin \
37 && glide --quiet install -v \
38 && go install -a -ldflags '-extldflags "-static"' github.com/intel/sriov-network-device-plugin/cmd/sriovdp \
39 && cp $GOPATH/bin/sriovdp /usr/local/bin/sriovdp \
40 && rm -rf $GOPATH/src \
41 && rm -rf $GOPATH/bin \
42 && apk del .tools \
43 && rm -rf $go_install_dir \
44 && rm -rf /var/cache/apk/* \
45 && rm -rf /var/lib/apt/lists/* \
46 && rm -rf /tmp/* \
47 && rm -rf ~/.glide
48
49 RUN chmod 700 /usr/local/bin/sriovdp
50
51 LABEL io.k8s.display-name="SRIOV Network Device Plugin"
52 ENTRYPOINT ["/usr/local/bin/sriovdp"]