-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile.rpmbuild
35 lines (27 loc) · 1.26 KB
/
Dockerfile.rpmbuild
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
FROM centos:7
RUN curl -L 'https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm' > /tmp/epel.rpm && \
rpm -i /tmp/epel.rpm
RUN yum install -y rpm-build
# RPM build requires the user to actually exist.
ARG USER_UID=1000
ARG USER_GID=1000
RUN groupadd -o -g $USER_GID build && useradd -o -u $USER_UID -g $USER_GID -d /build --create-home build
WORKDIR /build
# Output directory
RUN mkdir /RPMS && chown $USER_UID:$USER_GID /RPMS
VOLUME ["/RPMS"]
# Build & install the libjwt rpm
COPY rpm_specs/libjwt.spec /build/rpm_specs/libjwt.spec
RUN grep BuildRequires rpm_specs/libjwt.spec | sed -e 's|^BuildRequires: ||' | xargs yum install -y
USER build
RUN rpmbuild -ba rpm_specs/libjwt.spec
USER root
RUN rpm -i /build/rpmbuild/RPMS/x86_64/libjwt-[0-9]*.rpm
# Build the mod_proxy_jwt_auth rpm
COPY rpm_specs/mod_proxy_jwt_auth.spec /build/rpm_specs/mod_proxy_jwt_auth.spec
RUN grep BuildRequires rpm_specs/mod_proxy_jwt_auth.spec | sed -e 's|^BuildRequires: ||' | xargs yum install -y
COPY . /build/mod_proxy_jwt_auth
RUN chown -R $USER_UID:$USER_GID /build/mod_proxy_jwt_auth
USER build
# The cp is to make the path friendlier and to allow the image built libjwt to be copied out
CMD rpmbuild -ba rpm_specs/mod_proxy_jwt_auth.spec && cp /build/rpmbuild/RPMS/* /RPMS -rv