-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile.mockbuild
74 lines (66 loc) · 3.26 KB
/
Dockerfile.mockbuild
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#
# Copyright 2018-2024 Intel Corporation
#
# 'recipe' for Docker to build an RPM
#
# Pull base image
ARG FVERSION=latest
FROM fedora:$FVERSION
# Needed for later use of FVERSION
ARG FVERSION
LABEL maintainer="daos@daos.groups.io"
# Use local repo server if present
ARG REPO_FILE_URL
RUN if [ -n "$REPO_FILE_URL" ]; then \
cd /etc/yum.repos.d/ && \
curl -k -f -o daos_ci-fedora-artifactory.repo.tmp \
"$REPO_FILE_URL"daos_ci-fedora-artifactory.repo && \
for file in *.repo; do \
true > $file; \
done; \
mv daos_ci-fedora-artifactory.repo{.tmp,}; \
fi
# Install basic tools
RUN dnf -y install mock make \
rpm-build createrepo rpmlint redhat-lsb-core git \
python-srpm-macros rpmdevtools && \
dnf -y clean all
# use same UID as host and default value of 1000 if not specified
ARG UID=1000
# Add build user (to keep rpmbuild happy)
ENV USER build
ENV PASSWD build
# add the user to the mock group so it can run mock
RUN if [ $UID != 0 ]; then \
useradd -u $UID -ms /bin/bash $USER; \
echo "$USER:$PASSWD" | chpasswd; \
usermod -a -G mock $USER; \
fi
ARG CB0
RUN dnf -y upgrade && \
dnf clean all
# Monkey-patch rpmlint until a new release is made with
# https://github.com/rpm-software-management/rpmlint/pull/795 in it
# But make sure to patch after dnf upgrade so that an upgraded rpmlint
# RPM doesn't wipe out our patch
# Ditto for the patch to zero and display ccache stats
# https://github.com/rpm-software-management/mock/pull/1299
ARG PACKAGINGDIR=packaging
COPY ${PACKAGINGDIR}/*.patch ./
RUN (cd $(python3 -c 'import site; print(site.getsitepackages()[-1])') && \
if ! grep -e --ignore-unused-rpmlintrc rpmlint/cli.py; then \
if ! patch -p1 < $OLDPWD/rpmlint--ignore-unused-rpmlintrc.patch; then \
exit 1; \
fi; \
rm -f rpmlint/__pycache__/{cli,lint}.*.pyc; \
fi; \
if ! grep _ccachePostBuildHook mockbuild/plugins/ccache.py; then \
if ! patch -p3 < $OLDPWD/ccache-stats.patch; then \
exit 1; \
fi; \
rm -f mockbuild/plugins/__pycache__/ccache.*.pyc; \
fi); \
rm -f rpmlint--ignore-unused-rpmlintrc.patch ccache-stats.patch
# show the release that was built
ARG CACHEBUST
RUN cat /etc/os-release