-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathrpmbuild.Dockerfile
32 lines (24 loc) · 1010 Bytes
/
rpmbuild.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
FROM centos:7
ARG VERSION
ARG SPFS_PULL_USERNAME
ARG SPFS_PULL_PASSWORD
RUN yum install -y \
curl \
rpm-build \
&& yum clean all
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh /dev/stdin -y
ENV PATH $PATH:/root/.cargo/bin
RUN mkdir -p /root/rpmbuild/{SOURCES,SPECS,RPMS,SRPMS}
COPY spk.spec /root/rpmbuild/SPECS/
ENV VERSION ${VERSION}
RUN echo "Building for $VERSION"
# ensure the current build version matches the one in the rpm
# spec file, or things can go awry
RUN test "$VERSION" == "$(cat /root/rpmbuild/SPECS/spk.spec | grep Version | cut -d ' ' -f 2)"
RUN yum-builddep -y /root/rpmbuild/SPECS/spk.spec && yum clean all
COPY . /source/spk-$VERSION
ENV SPFS_PULL_USERNAME ${SPFS_PULL_USERNAME}
ENV SPFS_PULL_PASSWORD ${SPFS_PULL_PASSWORD}
RUN sed -i "s|github.com|$SPFS_PULL_USERNAME:$SPFS_PULL_PASSWORD@github.com|" /source/spk-$VERSION/Cargo.toml
RUN tar -C /source -czvf /root/rpmbuild/SOURCES/v$VERSION.tar.gz .
RUN rpmbuild -ba /root/rpmbuild/SPECS/spk.spec