-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
57 lines (46 loc) · 1.53 KB
/
Dockerfile
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
ARG DISTRO
ARG DISTRO_VER
FROM docker.io/${DISTRO}:${DISTRO_VER}
RUN dnf update -y \
&& dnf install -y \
rpm-build \
rpm-devel \
rpmlint \
rpmdevtools \
diffutils \
patch \
gcc \
make \
gpg* \
rng-tools \
wget \
curl \
ncurses-devel
RUN groupadd --gid 1000 rpmbuild \
&& useradd --uid 1000 --gid 1000 rpmbuild \
&& usermod -L rpmbuild
USER rpmbuild
WORKDIR /home/rpmbuild
ARG PICK_VERSION
ARG PICK_VERSION_TARBALL
ENV PICK_VERSION ${PICK_VERSION}
ENV PICK_VERSION_TARBALL ${PICK_VERSION_TARBALL}
ENV PICK_VERSION_SPEC_FILE_FROM_HOME "rpmbuild/SPECS/pick.spec"
RUN rpmdev-setuptree
# Download source
RUN cd rpmbuild/SOURCES/ \
&& wget "https://github.com/mptre/pick/archive/${PICK_VERSION_TARBALL}"
# This chown isn't working in podman for some reason. Manually running chown until it is fixed
COPY --chown=rpmbuild:rpmbuild pick.spec.tmpl /home/rpmbuild/
USER root
RUN chown rpmbuild:rpmbuild /home/rpmbuild/pick.spec.tmpl
USER rpmbuild
RUN cp pick.spec.tmpl "$PICK_VERSION_SPEC_FILE_FROM_HOME" \
&& sed -i -e "s/PICK_VERSION_TARBALL/$PICK_VERSION_TARBALL/g" "$PICK_VERSION_SPEC_FILE_FROM_HOME" \
&& sed -i -e "s/PICK_VERSION/$PICK_VERSION/g" "$PICK_VERSION_SPEC_FILE_FROM_HOME" \
&& chmod 644 "$PICK_VERSION_SPEC_FILE_FROM_HOME"
RUN rpmbuild -ba ${PICK_VERSION_SPEC_FILE_FROM_HOME}
RUN rpmbuild -bs ${PICK_VERSION_SPEC_FILE_FROM_HOME}
# Copy RPM files to home dir for easy extraction
RUN mkdir -p /home/rpmbuild/rpms \
&& mv rpmbuild/RPMS/*/pick*.rpm rpmbuild/SRPMS/pick*.rpm /home/rpmbuild/rpms/