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
7 # http://www.apache.org/licenses/LICENSE-2.0
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.
16 MAINTAINER Balazs Szekeres <balazs.szekeres@nokia.com>
18 ARG DEPENDENCY_MANAGER
19 ENV DEP_VERSION=$DEPENDENCY_MANAGER
21 ENV CPUPOOLER_VERSION=$CPUPOOLER
23 ENV PATH /usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
24 ENV BUILD_DIR="$GOPATH/src/github.com/nokia/CPU-Pooler"
28 && apk add --no-cache --virtual .build-deps build-base git mercurial go glide bash tar curl \
29 && curl -fsSL -o /usr/local/bin/dep https://github.com/golang/dep/releases/download/v${DEP_VERSION}/dep-linux-amd64 \
30 && chmod +x /usr/local/bin/dep \
31 && mkdir -p $BUILD_DIR \
32 && git clone https://github.com/Levovar/CPU-Pooler.git $BUILD_DIR \
35 && git checkout ${CPUPOOLER_VERSION} \
36 && dep ensure --vendor-only \
38 && CGO_ENABLED=0 GOOS=linux go build -a -ldflags '-extldflags "-static"' -o cpu-device-plugin ./cmd/cpu-device-plugin \
39 && mv $BUILD_DIR/cpu-device-plugin /cpu-device-plugin \
41 && CGO_ENABLED=0 GOOS=linux go build -a -ldflags '-extldflags "-static"' -o cpu-setter ./cmd/cpusetter \
42 && mv $BUILD_DIR/cpu-setter /cpu-setter \
44 && CGO_ENABLED=0 GOOS=linux go build -a -ldflags '-extldflags "-static"' -o cpu-device-webhook ./cmd/webhook \
45 && mv $BUILD_DIR/cpu-device-webhook /cpu-device-webhook \
46 && apk del .build-deps \
49 && rm -rf /root/.glide