0dbc5f942594048dee0bf20f740885cc4fb9e915
[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 DEP_MAN_VERSION
19 ARG go_install_dir="/usr/local/go"
20 ARG go_version
21 ENV GOBIN=/usr/local/bin
22 ENV GOPATH /build
23 ENV PATH="$GOPATH/bin:$go_install_dir/bin:$PATH"
24 ARG CPUPOOLER_VERSION
25
26 RUN yum update -y \
27 &&  yum install -y \
28       git \
29       bash \
30       glide \
31       libtool \
32       autoconf \
33       coreutils \
34       curl \
35       binutils \
36       tar \
37       grep \
38       make \
39       gcc \
40       gcc-c++ \
41 &&  mkdir -p $go_install_dir \
42 &&  curl -fsSL -k https://dl.google.com/go/go${go_version}.linux-amd64.tar.gz | tar zx --strip-components=1 -C ${go_install_dir} \
43 &&  curl -fsSL -o /usr/local/bin/dep https://github.com/golang/dep/releases/download/v${DEP_MAN_VERSION}/dep-linux-amd64 \
44 &&  chmod +x /usr/local/bin/dep \
45 &&  mkdir -p $GOPATH/src/github.com/nokia/CPU-Pooler \
46 &&  git clone https://github.com/nokia/CPU-Pooler.git $GOPATH/src/github.com/nokia/CPU-Pooler \
47 &&  cd $GOPATH/src/github.com/nokia/CPU-Pooler \
48 &&  git fetch --tags \
49 &&  git checkout ${CPUPOOLER_VERSION} \
50 &&  dep ensure --vendor-only \
51 # process-starter
52 &&  CGO_ENABLED=0 GOOS=linux go build -a -ldflags '-extldflags "-static"' -o process-starter ./cmd/process-starter \
53 &&  mv $GOPATH/src/github.com/nokia/CPU-Pooler/process-starter /process-starter \
54 &&  rm -rf $go_install_dir \
55 &&  rm -rf $GOPATH