|
| 1 | +ARG RHEL_VERSION |
| 2 | +FROM rockylinux:${RHEL_VERSION} |
| 3 | + |
| 4 | +ARG RHEL_VERSION |
| 5 | +ARG PG_VERSION |
| 6 | +ARG PG_RMAN_VERSION |
| 7 | + |
| 8 | +ENV PATH /usr/pgsql-${PG_VERSION}/bin:$PATH |
| 9 | +ENV PGDATA /var/lib/pgsql/${PG_VERSION}/data |
| 10 | + |
| 11 | + |
| 12 | +################################################################################ |
| 13 | +# |
| 14 | +# Prerequisite |
| 15 | +# |
| 16 | +################################################################################ |
| 17 | + |
| 18 | +# Install packages for build |
| 19 | +RUN dnf update -y |
| 20 | +RUN dnf install -y \ |
| 21 | + clang gcc git krb5-devel libselinux-devel libzstd-devel lz4-devel make \ |
| 22 | + openssl-devel pam-devel readline-devel rpmdevtools which zlib-devel |
| 23 | + |
| 24 | +# Install PostgreSQL |
| 25 | +RUN if [ "${RHEL_VERSION}" = "8" ]; then \ |
| 26 | + dnf install -y --enablerepo=powertools perl-IPC-Run; \ |
| 27 | + else \ |
| 28 | + dnf install -y --enablerepo=crb perl-IPC-Run; \ |
| 29 | + fi |
| 30 | +RUN dnf install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-${RHEL_VERSION}-x86_64/pgdg-redhat-repo-latest.noarch.rpm |
| 31 | +RUN dnf -qy module disable postgresql |
| 32 | +RUN dnf install -y postgresql${PG_VERSION}-server postgresql${PG_VERSION}-devel |
| 33 | + |
| 34 | + |
| 35 | +################################################################################ |
| 36 | +# |
| 37 | +# Build RPMs |
| 38 | +# |
| 39 | +################################################################################ |
| 40 | + |
| 41 | +# Build by postgres user |
| 42 | +USER postgres |
| 43 | +WORKDIR /var/lib/pgsql/ |
| 44 | + |
| 45 | +# Deploy the files required for the build |
| 46 | +RUN rpmdev-setuptree |
| 47 | +RUN git clone -b REL_${PG_VERSION}_STABLE https://github.com/ossc-db/pg_rman.git |
| 48 | +RUN cp -a pg_rman/SPECS/pg_rman${PG_VERSION}.spec rpmbuild/SPECS |
| 49 | +RUN cd pg_rman && \ |
| 50 | + git archive HEAD \ |
| 51 | + --format=tar.gz \ |
| 52 | + --prefix=pg_rman-${PG_RMAN_VERSION}-pg${PG_VERSION}/ \ |
| 53 | + --output=../rpmbuild/SOURCES/pg_rman-${PG_RMAN_VERSION}-pg${PG_VERSION}.tar.gz |
| 54 | + |
| 55 | +# Build RPMs |
| 56 | +RUN rpmbuild rpmbuild/SPECS/pg_rman${PG_VERSION}.spec \ |
| 57 | + -bb --define="dist .pg${PG_VERSION}.rhel${RHEL_VERSION}" |
| 58 | + |
| 59 | + |
| 60 | +################################################################################ |
| 61 | +# |
| 62 | +# Run regression tests |
| 63 | +# |
| 64 | +################################################################################ |
| 65 | + |
| 66 | +USER root |
| 67 | +RUN rpm -ivh /var/lib/pgsql/rpmbuild/RPMS/x86_64/* |
| 68 | + |
| 69 | +USER postgres |
| 70 | +RUN initdb --no-locale -E UTF8 && \ |
| 71 | + pg_ctl -w start |
| 72 | +RUN make -C pg_rman installcheck; exit 0 |
| 73 | +RUN cat /var/lib/pgsql/pg_rman/regression.out |
0 commit comments