-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNoDockerfile.centos.stream9
49 lines (37 loc) · 1.58 KB
/
NoDockerfile.centos.stream9
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#
# Copyright KubeInit
#
# All Rights Reserved.
#
# 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 quay.io/centos/centos:stream9 as centos9
ARG DISTRO=centos
ARG OS_VERSION=9
ARG ARCH=x86_64
ARG BUILD_TOOLS="jq yum-utils createrepo"
ARG DEST_PACKAGE_PATH="/root/rpmbuild/RPMS/x86_64"
RUN yum update -y -q && yum install -y $BUILD_TOOLS && yum makecache
RUN curl -sL -o /usr/local/bin/yq https://github.com/mikefarah/yq/releases/download/v4.25.2/yq_linux_amd64 && chmod a+x /usr/local/bin/yq
WORKDIR /$DISTRO-tmp
COPY * .
RUN ./packager.sh
WORKDIR /$DISTRO/$OS_VERSION/os/$ARCH
RUN mkdir -p $DEST_PACKAGE_PATH && cp -a $DEST_PACKAGE_PATH/* /$DISTRO/$OS_VERSION/os/$ARCH/
RUN ls /$DISTRO/$OS_VERSION/os/$ARCH/*.rpm | xargs -L1 > packages_built.list
RUN yq eval /$DISTRO-tmp/packages.yaml -j | jq -r '.common[],.yum[],.centos[]' | sort -u > packages.list # && rpm -qa >> packages.list
RUN cat packages.list | xargs yumdownloader --resolve
RUN cat packages_built.list | rev | cut -d"/" -f1 | rev >> packages.list && rm packages_built.list
RUN createrepo -d .
FROM scratch
COPY --from=centos9 /centos /centos