2f474e1413f397d04e9baf5b79adc9bdf9638186
[ta/caas-cpupooler.git] / docker-build / process-starter / 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 centos:7.6.1810
16 MAINTAINER Balazs Szekeres <balazs.szekeres@nokia.com>
17
18 ARG DEPENDENCY_MANAGER
19 ENV DEP_VERSION=$DEPENDENCY_MANAGER
20 ARG CPUPOOLER
21 ENV CPUPOOLER_VERSION=$CPUPOOLER
22 ENV GOPATH /build
23
24 RUN yum update -y \
25 &&  yum install -y \
26       go \
27       git \
28       bash \
29       glide \
30       libtool \
31       autoconf \
32       coreutils \
33       curl \
34       binutils \
35       tar \
36       grep \
37       make \
38       gcc \
39       gcc-c++ \
40 &&  rpm --import https://mirror.go-repo.io/centos/RPM-GPG-KEY-GO-REPO \
41 &&  curl -s https://mirror.go-repo.io/centos/go-repo.repo | tee /etc/yum.repos.d/go-repo.repo \
42 &&  yum install -y golang \
43 &&  curl -fsSL -o /usr/local/bin/dep https://github.com/golang/dep/releases/download/v${DEP_VERSION}/dep-linux-amd64 \
44 &&  chmod +x /usr/local/bin/dep \
45 &&  mkdir -p $GOPATH/src/github.com/nokia/CPU-Pooler \
46 &&  curl -fsSL -k https://github.com/nokia/CPU-Pooler/archive/v${CPUPOOLER_VERSION}.tar.gz | tar zx --strip-components=1 -C $GOPATH/src/github.com/nokia/CPU-Pooler \
47 &&  cd $GOPATH/src/github.com/nokia/CPU-Pooler \
48 &&  dep ensure --vendor-only \
49 # process-starter
50 &&  CGO_ENABLED=0 GOOS=linux go build -a -ldflags '-extldflags "-static"' -o process-starter ./cmd/process-starter \
51 &&  mv $GOPATH/src/github.com/nokia/CPU-Pooler/process-starter /process-starter \
52 &&  rm -rf $GOPATH 
53
54