# See the License for the specific language governing permissions and
# limitations under the License.
-FROM alpine:3.9
-MAINTAINER Balazs Szekeres <balazs.szekeres@nokia.com>
+ARG BUILDER_BASE=golang:1.13-alpine
+ARG FINAL_BASE=alpine:3.9.6
+ARG PROJECT_PATH=github.com/nokia/CPU-Pooler
-ARG DEP_MAN_VERSION
-ARG CPUPOOLER_VERSION
-ARG go_install_dir="/usr/local/go"
-ARG go_version
-ENV GOPATH /build
-ENV PATH $go_install_dir/bin:$PATH
-ENV BUILD_DIR="$GOPATH/src/github.com/nokia/CPU-Pooler"
+# Build stage
+FROM ${BUILDER_BASE} AS builder
+ARG PROJECT_PATH
+ENV CGO_ENABLED=0
+ENV GOOS=linux
-RUN apk update \
-&& apk upgrade \
-&& apk add --no-cache --virtual .build-deps build-base git mercurial go glide bash tar \
-&& apk add --no-cache curl \
-&& mkdir -p $go_install_dir \
-&& curl -fsSL -k https://dl.google.com/go/go${go_version}.src.tar.gz | tar zx --strip-components=1 -C ${go_install_dir} \
-&& cd ${go_install_dir}/src/ \
-&& ./make.bash \
-&& if [ $(uname -m) == 'aarch64' ]; then HOST_ARCH=arm64; else HOST_ARCH=amd64; fi \
-&& curl -fsSL -o /usr/local/bin/dep https://github.com/golang/dep/releases/download/v${DEP_MAN_VERSION}/dep-linux-$HOST_ARCH \
-&& chmod +x /usr/local/bin/dep \
-&& mkdir -p $BUILD_DIR \
-&& git clone https://github.com/nokia/CPU-Pooler.git $BUILD_DIR \
-&& cd $BUILD_DIR \
-&& git fetch --tags \
-&& git checkout ${CPUPOOLER_VERSION} \
-&& dep ensure --vendor-only \
-# cpu-device-plugin
-&& CGO_ENABLED=0 GOOS=linux go build -a -ldflags '-extldflags "-static"' -o cpu-device-plugin ./cmd/cpu-device-plugin \
-&& mv $BUILD_DIR/cpu-device-plugin /cpu-device-plugin \
-# cpu-setter
-&& CGO_ENABLED=0 GOOS=linux go build -a -ldflags '-extldflags "-static"' -o cpu-setter ./cmd/cpusetter \
-&& mv $BUILD_DIR/cpu-setter /cpu-setter \
-# cpu-webhook
-&& CGO_ENABLED=0 GOOS=linux go build -a -ldflags '-extldflags "-static"' -o cpu-device-webhook ./cmd/webhook \
-&& mv $BUILD_DIR/cpu-device-webhook /cpu-device-webhook \
-&& apk del .build-deps \
-&& rm -rf $GOPATH \
-&& rm -rf $go_install_dir \
-&& rm -rf /build \
-&& rm -rf /root/.glide
+RUN apk update && apk add --no-cache curl git
+WORKDIR ${GOPATH}/src/${PROJECT_PATH}/bin
+WORKDIR ${GOPATH}/src/${PROJECT_PATH}
+ADD go.* ./
+RUN go mod download
+ADD . ./
+RUN go build -a -ldflags '-extldflags "-static"' -o bin/ ${PROJECT_PATH}/cmd/...
+RUN mv bin/cpusetter bin/cpu-setter
+RUN mv bin/webhook bin/cpu-device-webhook
+RUN mv bin/process-starter /process-starter
+
+# Multi-binary image stage
+FROM ${FINAL_BASE}
+MAINTAINER Gabor Mate <gabor.mate@nokia.com>
+ARG PROJECT_PATH
+
+RUN apk update && apk add --no-cache curl util-linux && rm -f /var/cache/apk/*
+COPY --from=builder /go/src/${PROJECT_PATH}/bin/cpu-* /
+
+ENTRYPOINT ["/bin/sh"]
\ No newline at end of file
"bom": [
{
"name": "alpine-linux-container",
- "version": "3.9",
- "source-url": "https://github.com/gliderlabs/docker-alpine/archive/c4f4c7a6e14d6efeb9a160da464717e03d2cc3ee.tar.gz",
- "foss": "yes"
- },
- {
- "name": "musl",
- "version": "1.1.20-r3",
- "source-url": "https://git.alpinelinux.org/cgit/aports/tree/main/musl/APKBUILD?h=3.9-stable",
- "foss": "yes"
- },
- {
- "name": "busybox",
- "version": "1.29.3-r10",
- "source-url": "https://git.alpinelinux.org/cgit/aports/tree/main/busybox/APKBUILD?h=3.9-stable",
+ "version": "3.9.6",
+ "source-url": "https://github.com/alpinelinux/docker-alpine/archive/d7eb97a39abbdfe6ba73236f844cb80b756280d1.tar.gz",
"foss": "yes"
},
{
"name": "alpine-baselayout",
"version": "3.1.0-r3",
- "source-url": "https://git.alpinelinux.org/cgit/aports/tree/main/alpine-baselayout/APKBUILD?h=3.9-stable",
+ "source-url": "https://git.alpinelinux.org/aports/tree/main/alpine-baselayout/APKBUILD?h=3.9-stable",
"foss": "yes"
},
{
"name": "alpine-keys",
"version": "2.1-r1",
- "source-url": "https://git.alpinelinux.org/cgit/aports/tree/main/alpine-keys/APKBUILD?h=3.9-stable",
+ "source-url": "https://git.alpinelinux.org/aports/tree/main/alpine-keys/APKBUILD?h=3.9-stable",
"foss": "yes"
},
{
- "name": "libcrypto1.1",
- "version": "1.1.1a-r1",
- "source-url": "https://git.alpinelinux.org/aports/tree/main/openssl/APKBUILD?h=3.9-stable",
+ "name": "apk-tools",
+ "version": "2.10.3-r1",
+ "source-url": "https://git.alpinelinux.org/aports/tree/main/apk-tools/APKBUILD?h=3.9-stable",
"foss": "yes"
},
{
- "name": "libssl1.1",
- "version": "1.1.1a-r1",
- "source-url": "https://git.alpinelinux.org/aports/tree/main/openssl/APKBUILD?h=3.9-stable",
+ "name": "busybox",
+ "version": "1.29.3-r10",
+ "source-url": "https://git.alpinelinux.org/aports/tree/main/busybox/APKBUILD?h=3.9-stable",
+ "foss": "yes"
+ },
+ {
+ "name": "ca-certificates",
+ "version": "20191127-r0",
+ "source-url": "https://git.alpinelinux.org/aports/tree/main/ca-certificates/APKBUILD?h=3.9-stable",
"foss": "yes"
},
{
"name": "ca-certificates-cacert",
- "version": "20190108-r0",
+ "version": "20191127-r0",
"source-url": "https://git.alpinelinux.org/aports/tree/main/ca-certificates/APKBUILD?h=3.9-stable",
"foss": "yes"
},
{
- "name": "libtls-standalone",
- "version": "2.7.4-r6",
- "source-url": "https://git.alpinelinux.org/aports/tree/main/libtls-standalone/APKBUILD?h=3.9-stable",
+ "name": "curl",
+ "version": "7.64.0-r4",
+ "source-url": "https://git.alpinelinux.org/aports/tree/main/curl/APKBUILD?h=3.9-stable",
"foss": "yes"
},
{
- "name": "ssl_client",
- "version": "1.29.3-r10",
- "source-url": "https://git.alpinelinux.org/aports/tree/main/busybox/APKBUILD?h=3.9-stable",
+ "name": "findmnt",
+ "version": "2.33-r0",
+ "source-url": "https://git.alpinelinux.org/aports/tree/main/util-linux/APKBUILD?h=3.9-stable",
"foss": "yes"
},
{
- "name": "zlib",
- "version": "1.2.11-r1",
- "source-url": "https://git.alpinelinux.org/cgit/aports/tree/main/zlib/APKBUILD?h=3.9-stable",
+ "name": "libblkid",
+ "version": "2.33-r0",
+ "source-url": "https://git.alpinelinux.org/aports/tree/main/util-linux/APKBUILD?h=3.9-stable",
"foss": "yes"
},
{
- "name": "apk-tools",
- "version": "2.10.3-r1",
- "source-url": "https://git.alpinelinux.org/cgit/aports/tree/main/apk-tools/APKBUILD?h=3.9-stable",
+ "name": "libc-utils",
+ "version": "0.7.1-r0",
+ "source-url": "https://git.alpinelinux.org/aports/tree/main/libc-dev/APKBUILD?h=3.9-stable",
"foss": "yes"
},
{
- "name": "scanelf",
- "version": "1.2.3-r0",
- "source-url": "https://git.alpinelinux.org/aports/tree/main/pax-utils/APKBUILD?h=3.9-stable",
+ "name": "libcrypto1.1",
+ "version": "1.1.1g-r0",
+ "source-url": "https://git.alpinelinux.org/aports/tree/main/openssl/APKBUILD?h=3.9-stable",
"foss": "yes"
},
{
- "name": "musl-utils",
- "version": "1.1.20-r3",
- "source-url": "https://git.alpinelinux.org/aports/tree/main/musl/APKBUILD?h=3.9-stable",
+ "name": "libcurl",
+ "version": "7.64.0-r4",
+ "source-url": "https://git.alpinelinux.org/aports/tree/main/curl/APKBUILD?h=3.9-stable",
"foss": "yes"
},
{
- "name": "libc-utils",
- "version": "0.7.1-r0",
- "source-url": "https://git.alpinelinux.org/cgit/aports/tree/main/libc-dev/APKBUILD?h=3.9-stable",
+ "name": "libssh2",
+ "version": "1.9.0-r1",
+ "source-url": "https://git.alpinelinux.org/aports/tree/main/libssh2/APKBUILD?h=3.9-stable",
"foss": "yes"
},
{
- "name": "libbz2",
- "version": "1.0.6-r6",
- "source-url": "https://git.alpinelinux.org/cgit/aports/tree/main/bzip2/APKBUILD?h=3.9-stable",
+ "name": "libfdisk",
+ "version": "2.33-r0",
+ "source-url": "https://git.alpinelinux.org/aports/tree/main/util-linux/APKBUILD?h=3.9-stable",
"foss": "yes"
},
{
- "name": "expat",
- "version": "2.2.6-r0",
- "source-url": "https://git.alpinelinux.org/cgit/aports/tree/main/expat/APKBUILD?h=3.9-stable",
+ "name": "libmount",
+ "version": "2.33-r0",
+ "source-url": "https://git.alpinelinux.org/aports/tree/main/util-linux/APKBUILD?h=3.9-stable",
"foss": "yes"
},
{
- "name": "libffi",
- "version": "3.2.1-r6",
- "source-url": "https://git.alpinelinux.org/cgit/aports/tree/main/libffi/APKBUILD?h=3.9-stable",
+ "name": "libsmartcols",
+ "version": "2.33-r0",
+ "source-url": "https://git.alpinelinux.org/aports/tree/main/util-linux/APKBUILD?h=3.9-stable",
"foss": "yes"
},
{
- "name": "gdbm",
- "version": "1.13-r1",
- "source-url": "https://git.alpinelinux.org/cgit/aports/tree/main/gdbm/APKBUILD?h=3.9-stable",
+ "name": "libssl1.1",
+ "version": "1.1.1g-r0",
+ "source-url": "https://git.alpinelinux.org/aports/tree/main/openssl/APKBUILD?h=3.9-stable",
"foss": "yes"
},
{
- "name": "ncurses-terminfo-base",
- "version": "6.1_p20190105-r0",
- "source-url": "https://git.alpinelinux.org/aports/tree/main/ncurses/APKBUILD?h=3.9-stable",
+ "name": "libtls-standalone",
+ "version": "2.7.4-r6",
+ "source-url": "https://git.alpinelinux.org/aports/tree/main/libtls-standalone/APKBUILD?h=3.9-stable",
"foss": "yes"
},
{
- "name": "ncurses-terminfo",
- "version": "6.1_p20190105-r0",
- "source-url": "https://git.alpinelinux.org/aports/tree/main/ncurses/APKBUILD?h=3.9-stable",
+ "name": "libuuid",
+ "version": "2.33-r0",
+ "source-url": "https://git.alpinelinux.org/aports/tree/main/util-linux/APKBUILD?h=3.9-stable",
"foss": "yes"
},
{
- "name": "ncurses-libs",
- "version": "6.1_p20190105-r0",
- "source-url": "https://git.alpinelinux.org/aports/tree/main/ncurses/APKBUILD?h=3.9-stable",
+ "name": "musl",
+ "version": "1.1.20-r5",
+ "source-url": "https://git.alpinelinux.org/aports/tree/main/musl/APKBUILD?h=3.9-stable",
+ "foss": "yes"
+ },
+ {
+ "name": "musl-utils",
+ "version": "1.1.20-r5",
+ "source-url": "https://git.alpinelinux.org/aports/tree/main/musl/APKBUILD?h=3.9-stable",
"foss": "yes"
},
{
- "name": "readline",
- "version": "7.0.003-r1",
- "source-url": "https://git.alpinelinux.org/cgit/aports/tree/main/readline/APKBUILD?h=3.9-stable",
+ "name": "ncurses-libs",
+ "version": "6.1_p20190105-r0",
+ "source-url": "https://git.alpinelinux.org/aports/tree/main/ncurses/APKBUILD?h=3.9-stable",
"foss": "yes"
},
{
- "name": "sqlite-libs",
- "version": "3.26.0-r3",
- "source-url": "https://git.alpinelinux.org/aports/tree/main/sqlite/APKBUILD?h=3.9-stable",
+ "name": "ncurses-terminfo",
+ "version": "6.1_p20190105-r0",
+ "source-url": "https://git.alpinelinux.org/aports/tree/main/ncurses/APKBUILD?h=3.9-stable",
"foss": "yes"
},
{
- "name": "python2",
- "version": "2.7.15-r3",
- "source-url": "https://git.alpinelinux.org/cgit/aports/tree/main/python2/APKBUILD?h=3.9-stable",
+ "name": "ncurses-terminfo-base",
+ "version": "6.1_p20190105-r0",
+ "source-url": "https://git.alpinelinux.org/aports/tree/main/ncurses/APKBUILD?h=3.9-stable",
"foss": "yes"
},
{
- "name": "py-setuptools",
- "version": "40.6.3-r0",
- "source-url": "https://git.alpinelinux.org/cgit/aports/tree/main/py-setuptools/APKBUILD?h=3.9-stable",
+ "name": "nghttp2-libs",
+ "version": "1.35.1-r2",
+ "source-url": "https://git.alpinelinux.org/aports/tree/main/nghttp2/APKBUILD?h=3.9-stable",
"foss": "yes"
},
{
- "name": "py2-pip",
- "version": "18.1-r0",
- "source-url": "https://git.alpinelinux.org/cgit/aports/tree/main/py2-pip/APKBUILD?h=3.9-stable",
+ "name": "scanelf",
+ "version": "1.2.3-r0",
+ "source-url": "https://git.alpinelinux.org/aports/tree/main/pax-utils/APKBUILD?h=3.9-stable",
"foss": "yes"
},
{
- "name": "pip",
- "version": "19.0.2",
- "source-url": "https://github.com/pypa/pip/archive/19.0.2.tar.gz",
+ "name": "ssl_client",
+ "version": "1.29.3-r10",
+ "source-url": "https://git.alpinelinux.org/aports/tree/main/busybox/APKBUILD?h=3.9-stable",
"foss": "yes"
},
{
- "name": "setuptools",
- "version": "40.6.3.post20190116",
- "source-url": "https://github.com/pypa/setuptools/archive/v40.6.3.tar.gz",
+ "name": "util-linux",
+ "version": "2.33-r0",
+ "source-url": "https://git.alpinelinux.org/aports/tree/main/util-linux/APKBUILD?h=3.9-stable",
"foss": "yes"
},
{
- "name": "dep-linux",
- "version": "0.5.0",
- "source-url": "https://github.com/golang/dep/archive/v0.5.0.tar.gz",
+ "name": "zlib",
+ "version": "1.2.11-r1",
+ "source-url": "https://git.alpinelinux.org/aports/tree/main/zlib/APKBUILD?h=3.9-stable",
"foss": "yes"
},
{
"name": "cpupooler",
- "version": "0.2.0",
- "source-url": "https://github.com/nokia/CPU-Pooler/archive/v0.2.0.tar.gz",
+ "version": "0.3.1-15-g0adced7",
+ "source-url": "https://github.com/nokia/CPU-Pooler/archive/0adced79e87e4cb87c41a70a654be377ca2d505f.tar.gz",
"foss": "yes"
}
]
+++ /dev/null
-# Copyright 2019 Nokia
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-FROM scratch
-ADD centos-7-docker.tar.xz /
-CMD ["/bin/bash"]
-MAINTAINER Balazs Szekeres <balazs.szekeres@nokia.com>
-
-ARG DEP_MAN_VERSION
-ARG go_install_dir="/usr/local/go"
-ARG go_version
-ENV GOBIN=/usr/local/bin
-ENV GOPATH /build
-ENV PATH="$GOPATH/bin:$go_install_dir/bin:$PATH"
-ARG CPUPOOLER_VERSION
-
-RUN yum update -y \
-&& yum install -y \
- git \
- bash \
- glide \
- libtool \
- autoconf \
- coreutils \
- curl \
- binutils \
- tar \
- grep \
- make \
- gcc \
- gcc-c++ \
-&& mkdir -p $go_install_dir \
-&& if [ $(uname -m) == 'aarch64' ]; then HOST_ARCH=arm64; else HOST_ARCH=amd64; fi \
-&& 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} \
-&& curl -fsSL -o /usr/local/bin/dep https://github.com/golang/dep/releases/download/v${DEP_MAN_VERSION}/dep-linux-$HOST_ARCH \
-&& chmod +x /usr/local/bin/dep \
-&& mkdir -p $GOPATH/src/github.com/nokia/CPU-Pooler \
-&& git clone https://github.com/nokia/CPU-Pooler.git $GOPATH/src/github.com/nokia/CPU-Pooler \
-&& cd $GOPATH/src/github.com/nokia/CPU-Pooler \
-&& git fetch --tags \
-&& git checkout ${CPUPOOLER_VERSION} \
-&& dep ensure --vendor-only \
-# process-starter
-&& CGO_ENABLED=0 GOOS=linux go build -a -ldflags '-extldflags "-static"' -o process-starter ./cmd/process-starter \
-&& mv $GOPATH/src/github.com/nokia/CPU-Pooler/process-starter /process-starter \
-&& rm -rf $go_install_dir \
-&& rm -rf $GOPATH
# limitations under the License.
%define COMPONENT cpupooler
-%define COMPONENT_PART process-starter
%define RPM_NAME caas-%{COMPONENT}
-%define RPM_MAJOR_VERSION 0.3.0
-%define RPM_MINOR_VERSION 9
-%define go_version 1.12.10
-%define CPUPOOLER_VERSION e0459346946b0907d26cd3d79dc54feb2c625286
-%define DEP_MAN_VERSION 0.5.4
+%define RPM_MAJOR_VERSION 0.3.1
+%define RPM_MINOR_VERSION 15
+%define CPUPOOLER_VERSION 0adced79e87e4cb87c41a70a654be377ca2d505f
%define IMAGE_TAG %{RPM_MAJOR_VERSION}-%{RPM_MINOR_VERSION}
%define PROCESS_STARTER_INSTALL_PATH /opt/bin/
-%define centos_build 191001
+%define PROJECT_NAME CPU-Pooler
+%define PROJECT_BUILD_ROOT %{_builddir}/%{RPM_NAME}-%{RPM_MAJOR_VERSION}
Name: %{RPM_NAME}
Version: %{RPM_MAJOR_VERSION}
Release: %{RPM_MINOR_VERSION}%{?dist}
Summary: Containers as a Service cpu-pooler component
License: %{_platform_license} and BSD 3-Clause License
-URL: https://github.com/nokia/CPU-Pooler
+URL: https://github.com/nokia/%{PROJECT_NAME}
BuildArch: %{_arch}
Vendor: %{_platform_vendor} and Nokia
Source0: %{name}-%{version}.tar.gz
+Source1: %{url}/archive/%{CPUPOOLER_VERSION}.tar.gz
Requires: docker-ce >= 18.09.2, rsync
BuildRequires: docker-ce-cli >= 18.09.2, xz, wget
This RPM contains the cpu-pooler container image, process-starter binary and related deployment artifacts for the CaaS subsystem.
%prep
+wget --progress=dot:giga --directory-prefix=%{_sourcedir} %{url}/archive/%{CPUPOOLER_VERSION}.tar.gz
%autosetup
+# Autosetup extracts Source1 tar.gz to build directory and changes directory into it
+%autosetup -b 1 -T -n %{PROJECT_NAME}-%{CPUPOOLER_VERSION}
%build
-wget --progress=dot:giga http://artifacts.ci.centos.org/sig-cloudinstance/centos-7-%{centos_build}/%{_arch}/centos-7-%{_arch}-docker.tar.xz -O %{_builddir}/%{RPM_NAME}-%{RPM_MAJOR_VERSION}/docker-build/%{COMPONENT_PART}/centos-7-docker.tar.xz
-# build the process-starter binary inside a builder conatiner
+# build the cpu-pooler multi-binary image
docker build \
- --network=host \
- --no-cache \
- --force-rm \
- --build-arg HTTP_PROXY="${http_proxy}" \
- --build-arg HTTPS_PROXY="${https_proxy}" \
- --build-arg NO_PROXY="${no_proxy}" \
- --build-arg http_proxy="${http_proxy}" \
- --build-arg https_proxy="${https_proxy}" \
- --build-arg no_proxy="${no_proxy}" \
- --build-arg go_version="%{go_version}" \
- --build-arg DEP_MAN_VERSION="%{DEP_MAN_VERSION}" \
- --build-arg CPUPOOLER_VERSION="%{CPUPOOLER_VERSION}" \
- --tag %{COMPONENT_PART}:builder \
- %{_builddir}/%{RPM_NAME}-%{RPM_MAJOR_VERSION}/docker-build/%{COMPONENT_PART}/
+ --network host \
+ --build-arg http_proxy \
+ --build-arg https_proxy \
+ --build-arg no_proxy \
+ --tag %{COMPONENT}:%{IMAGE_TAG} \
+ -f %{PROJECT_BUILD_ROOT}/docker-build/%{COMPONENT}/Dockerfile \
+ %{_builddir}/%{PROJECT_NAME}-%{CPUPOOLER_VERSION}
+
+# build the builder image containing the binaries
+docker build \
+ --network host \
+ --build-arg http_proxy \
+ --build-arg https_proxy \
+ --build-arg no_proxy \
+ --target builder \
+ --tag %{COMPONENT}:builder \
+ -f %{PROJECT_BUILD_ROOT}/docker-build/%{COMPONENT}/Dockerfile \
+ %{_builddir}/%{PROJECT_NAME}-%{CPUPOOLER_VERSION}
# create a directory for process-starter binary
-mkdir -p %{_builddir}/%{RPM_NAME}-%{RPM_MAJOR_VERSION}/results
-
-# run the builder conatiner for process-starter binary
-docker run \
- -id \
- --rm \
- --network=host \
- --privileged \
- -e HTTP_PROXY="${http_proxy}" \
- -e HTTPS_PROXY="${https_proxy}" \
- -e NO_PROXY="${no_proxy}" \
- -e http_proxy="${http_proxy}" \
- -e https_proxy="${https_proxy}" \
- -e no_proxy="${no_proxy}" \
- --entrypoint=/bin/sh \
- %{COMPONENT_PART}:builder
-
-# get the process-starter binary
-docker cp $(docker ps | grep "%{COMPONENT_PART}:builder" | awk -F' ' '{ print $1 }'):/process-starter %{_builddir}/%{RPM_NAME}-%{RPM_MAJOR_VERSION}/results/
+mkdir -p %{PROJECT_BUILD_ROOT}/results
-# rm container
-for container_ran in $(docker ps -a | grep "%{COMPONENT_PART}:builder" | awk -F' ' '{ print $1 }')
-do
- docker rm -f $container_ran
-done
+# run the builder container for process-starter binary
+docker create --name=%{COMPONENT}-temp %{COMPONENT}:builder
-# remove docker image
-docker rmi -f %{COMPONENT_PART}:builder
+# extract process-starter binary
+docker cp %{COMPONENT}-temp:/process-starter %{PROJECT_BUILD_ROOT}/results/
-# build the cpu pooler
-docker build \
- --network=host \
- --no-cache \
- --force-rm \
- --build-arg HTTP_PROXY="${http_proxy}" \
- --build-arg HTTPS_PROXY="${https_proxy}" \
- --build-arg NO_PROXY="${no_proxy}" \
- --build-arg http_proxy="${http_proxy}" \
- --build-arg https_proxy="${https_proxy}" \
- --build-arg no_proxy="${no_proxy}" \
- --build-arg DEP_MAN_VERSION="%{DEP_MAN_VERSION}" \
- --build-arg CPUPOOLER_VERSION="%{CPUPOOLER_VERSION}" \
- --build-arg go_version="%{go_version}" \
- --tag %{COMPONENT}:%{IMAGE_TAG} \
- %{_builddir}/%{RPM_NAME}-%{RPM_MAJOR_VERSION}/docker-build/%{COMPONENT}/
+# rm container
+docker rm -v %{COMPONENT}-temp
# create a save folder
-mkdir -p %{_builddir}/%{RPM_NAME}-%{RPM_MAJOR_VERSION}/docker-save/
+mkdir -p %{PROJECT_BUILD_ROOT}/docker-save/
# save the cpu poooler container
-docker save %{COMPONENT}:%{IMAGE_TAG} | xz -z -T2 > %{_builddir}/%{RPM_NAME}-%{RPM_MAJOR_VERSION}/docker-save/%{COMPONENT}:%{IMAGE_TAG}.tar
+docker save %{COMPONENT}:%{IMAGE_TAG} | xz -z -T2 > %{PROJECT_BUILD_ROOT}/docker-save/%{COMPONENT}:%{IMAGE_TAG}.tar
-# remove docker image
-docker rmi -f %{COMPONENT}:%{IMAGE_TAG}
+# remove docker images, containers
+docker rmi -f %{COMPONENT}:%{IMAGE_TAG} %{COMPONENT}:builder
+docker container prune --force
+docker image prune --force
%install
mkdir -p %{buildroot}/%{_caas_container_tar_path}/
-rsync -av %{_builddir}/%{RPM_NAME}-%{RPM_MAJOR_VERSION}/docker-save/%{COMPONENT}:%{IMAGE_TAG}.tar %{buildroot}/%{_caas_container_tar_path}/
+rsync -av %{PROJECT_BUILD_ROOT}/docker-save/%{COMPONENT}:%{IMAGE_TAG}.tar %{buildroot}/%{_caas_container_tar_path}/
mkdir -p %{buildroot}%{PROCESS_STARTER_INSTALL_PATH}
-rsync -av %{_builddir}/%{RPM_NAME}-%{RPM_MAJOR_VERSION}/results/process-starter %{buildroot}/%{PROCESS_STARTER_INSTALL_PATH}/
+rsync -av %{PROJECT_BUILD_ROOT}/results/process-starter %{buildroot}/%{PROCESS_STARTER_INSTALL_PATH}/
mkdir -p %{buildroot}/%{_playbooks_path}/
-rsync -av ansible/playbooks/cpupooler.yaml %{buildroot}/%{_playbooks_path}/
+rsync -av %{PROJECT_BUILD_ROOT}/ansible/playbooks/cpupooler.yaml %{buildroot}/%{_playbooks_path}/
mkdir -p %{buildroot}/%{_roles_path}/
-rsync -av ansible/roles/cpupooler %{buildroot}/%{_roles_path}/
+rsync -av %{PROJECT_BUILD_ROOT}/ansible/roles/cpupooler %{buildroot}/%{_roles_path}/
%files
%{_caas_container_tar_path}/%{COMPONENT}:%{IMAGE_TAG}.tar
fi
%clean
-rm -rf ${buildroot}
+rm -rf ${buildroot}
\ No newline at end of file