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