|
| 1 | +# vim:set ft=dockerfile: |
| 2 | +FROM oraclelinux:6 |
| 3 | +RUN [[ oraclelinux != centos ]] || [[ 6 != 8 ]] || ( \ |
| 4 | + cd /etc/yum.repos.d/ && sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-* \ |
| 5 | + && sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.epel.cloud|g' /etc/yum.repos.d/CentOS-* \ |
| 6 | + ) |
| 7 | + |
| 8 | +RUN yum -y update |
| 9 | + |
| 10 | +RUN [[ oraclelinux != centos ]] || [[ 6 != 8 ]] || ( \ |
| 11 | + dnf install epel-release -y && \ |
| 12 | + dnf install dnf-plugins-core -y && \ |
| 13 | + dnf install epel-release -y && \ |
| 14 | + dnf config-manager --set-enabled powertools && \ |
| 15 | + dnf install -y perl-IPC-Run \ |
| 16 | + ) |
| 17 | + |
| 18 | +RUN [[ oraclelinux != almalinux ]] || [[ 6 != 8 ]] || ( \ |
| 19 | + dnf install epel-release -y && \ |
| 20 | + dnf install dnf-plugins-core -y && \ |
| 21 | + dnf install epel-release -y && \ |
| 22 | + dnf config-manager --set-enabled powertools && \ |
| 23 | + dnf install -y perl-IPC-Run \ |
| 24 | + ) |
| 25 | + |
| 26 | +RUN [[ oraclelinux != oraclelinux ]] || [[ 6 != 8 ]] || ( \ |
| 27 | + curl -sO https://vault.centos.org/centos/8/PowerTools/x86_64/os/Packages/perl-IO-Tty-1.12-11.el8.x86_64.rpm && \ |
| 28 | + curl -sO https://vault.centos.org/centos/8/PowerTools/x86_64/os/Packages/perl-IPC-Run-0.99-1.el8.noarch.rpm && \ |
| 29 | + dnf install perl-IO-Tty-1.12-11.el8.x86_64.rpm -y && \ |
| 30 | + dnf install perl-IPC-Run-0.99-1.el8.noarch.rpm -y && \ |
| 31 | + rm -f perl-IPC-Run-0.99-1.el8.noarch.rpm && \ |
| 32 | + rm -f perl-IO-Tty-1.12-11.el8.x86_64.rpm \ |
| 33 | + ) |
| 34 | + |
| 35 | +RUN [[ oraclelinux != almalinux ]] || [[ 6 != 9 ]] || ( \ |
| 36 | + dnf install epel-release -y && \ |
| 37 | + dnf -y install dnf-plugins-core && \ |
| 38 | + dnf config-manager --enable epel && \ |
| 39 | + dnf config-manager --set-enabled crb && \ |
| 40 | + dnf install -y perl-IPC-Run \ |
| 41 | + ) |
| 42 | + |
| 43 | +# FIXME: Hack around docker/docker#10180 |
| 44 | +RUN ( yum install -y yum-plugin-ovl || yum install -y yum-plugin-ovl || touch /var/lib/rpm/* ) \ |
| 45 | + && yum clean all |
| 46 | + |
| 47 | +# Enable some other repos for some dependencies in OL/7 |
| 48 | +# see https://yum.oracle.com/getting-started.html#installing-from-oracle-linux-yum-server |
| 49 | +RUN [[ oraclelinux != oraclelinux ]] || [[ 6 != 7 ]] || ( \ |
| 50 | + yum install -y oraclelinux-release-el7 oracle-softwarecollection-release-el7 oracle-epel-release-el7 oraclelinux-developer-release-el7 \ |
| 51 | + && yum-config-manager --enable \ |
| 52 | + ol7_software_collections \ |
| 53 | + ol7_developer \ |
| 54 | + ol7_developer_EPEL \ |
| 55 | + ol7_optional_latest \ |
| 56 | + ol7_optional_archive \ |
| 57 | + ol7_u9_base \ |
| 58 | + ol7_security_validation \ |
| 59 | + ol7_addons \ |
| 60 | + ) |
| 61 | + |
| 62 | +# lz4 1.8 is preloaded in oracle 7 however, lz4-devel is not loaded and only 1.7.5 version exists |
| 63 | +# in oracle 7 repos. So package from centos repo was used |
| 64 | +# There is no package in oracle repos for lz4. Also it is not preloaded. So both lz4 and lz4-devel packages |
| 65 | +# were downloaded from centos el/6 repos |
| 66 | +RUN if [[ oraclelinux == oraclelinux ]] && [[ 6 == 7 ]]; then yum install -y wget \ |
| 67 | + && wget http://mirror.centos.org/centos/7/os/x86_64/Packages/lz4-devel-1.8.3-1.el7.x86_64.rpm \ |
| 68 | + && rpm -ivh lz4-devel-1.8.3-1.el7.x86_64.rpm ; \ |
| 69 | + elif [[ oraclelinux == oraclelinux ]] && [[ 6 == 6 ]]; then yum install -y wget \ |
| 70 | + && wget https://cbs.centos.org/kojifiles/packages/lz4/r131/1.el6/x86_64/lz4-r131-1.el6.x86_64.rpm \ |
| 71 | + && rpm -ivh lz4-r131-1.el6.x86_64.rpm \ |
| 72 | + && wget https://cbs.centos.org/kojifiles/packages/lz4/r131/1.el6/x86_64/lz4-devel-r131-1.el6.x86_64.rpm \ |
| 73 | + && rpm -ivh lz4-devel-r131-1.el6.x86_64.rpm; \ |
| 74 | + else yum install -y lz4 lz4-devel; fi |
| 75 | + |
| 76 | +# install build tools and PostgreSQL development files |
| 77 | +RUN ( yum install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-6-x86_64/pgdg-redhat-repo-latest.noarch.rpm \ |
| 78 | + && ( [[ 17 != 17 ]] || sed -i '/\[pgdg17-updates-testing\]/{n;n;n;s/.*/enabled=1/}' /etc/yum.repos.d/pgdg-redhat-all.repo ) \ |
| 79 | + && [[ -z "" ]] || yum install -y ) \ |
| 80 | + && yum groupinstall -y 'Development Tools' \ |
| 81 | + && yum install -y \ |
| 82 | + bzip2-devel \ |
| 83 | + libffi-devel \ |
| 84 | + xz-devel \ |
| 85 | + flex \ |
| 86 | + gcc-c++ \ |
| 87 | + hunspell-en \ |
| 88 | + libcurl-devel \ |
| 89 | + libicu-devel \ |
| 90 | + libstdc++-devel \ |
| 91 | + libxml2-devel \ |
| 92 | + libxslt-devel \ |
| 93 | + openssl-devel \ |
| 94 | + pam-devel \ |
| 95 | + readline-devel \ |
| 96 | + rpm-build \ |
| 97 | + rpmlint \ |
| 98 | + tar \ |
| 99 | + libzstd \ |
| 100 | + libzstd-devel \ |
| 101 | + llvm-toolset-7-clang llvm5.0 spectool curl \ |
| 102 | + && ( [[ 6 != 8 ]] || dnf -qy module disable postgresql ) \ |
| 103 | + && yum install -y postgresql17-server postgresql17-devel \ |
| 104 | + && yum clean all |
| 105 | + |
| 106 | +# install jq to process JSON API responses |
| 107 | +RUN curl -sL https://github.com/stedolan/jq/releases/download/jq-1.5/jq-linux64 \ |
| 108 | + -o /usr/bin/jq \ |
| 109 | + && chmod +x /usr/bin/jq |
| 110 | + |
| 111 | +# install devtoolset-8-gcc on distros where it is available |
| 112 | +RUN { \ |
| 113 | + { yum search devtoolset-8-gcc 2>&1 | grep 'No matches found' ; } \ |
| 114 | + || yum install -y devtoolset-8-gcc devtoolset-8-libstdc++-devel; \ |
| 115 | + } \ |
| 116 | + && yum clean all |
| 117 | + |
| 118 | +# install sphinx on distros with python3 |
| 119 | +RUN { \ |
| 120 | + { yum search python3-pip 2>&1 | grep 'No matches found' ; } \ |
| 121 | + || { \ |
| 122 | + yum install -y python3-pip && \ |
| 123 | + pip3 install sphinx==1.8 \ |
| 124 | + ; \ |
| 125 | + } \ |
| 126 | + } \ |
| 127 | + && yum clean all |
| 128 | + |
| 129 | +# install cmake, devtoolset and its dependencies to build azure sdk |
| 130 | +RUN yum -y install perl-IPC-Cmd libuuid-devel cmake3 |
| 131 | + |
| 132 | +# by default git 1.8.x is being installed in centos 7 |
| 133 | +# Git 2.7.1 is minimum requirement for cmake so we remove and reinstall latests git from an up-to-date repo |
| 134 | +# Symbolic link is not being created for cmake from cmake3 by default. Therefore, we need to create the link as well. |
| 135 | +# devtoolset-8-gcc-c++ is required to compile azure sdk in pg azure storage project |
| 136 | +RUN [[ oraclelinux != centos ]] || [[ 6 != 7 ]] || ( \ |
| 137 | + yum -y install perl-IPC-Cmd libuuid-devel cmake3 && \ |
| 138 | + ln -s /usr/bin/cmake3 /usr/bin/cmake && \ |
| 139 | + yum -y remove git && \ |
| 140 | + yum -y install https://packages.endpointdev.com/rhel/7/os/x86_64/endpoint-repo.x86_64.rpm && \ |
| 141 | + yum -y install git && \ |
| 142 | + yum -y install devtoolset-8-gcc-c++ && scl enable devtoolset-8 bash && \ |
| 143 | + yum -y install llvm-toolset-7 && \ |
| 144 | + yum clean all \ |
| 145 | + ) |
| 146 | + |
| 147 | +# install python 3.8 to be able to execute tools scripts |
| 148 | +ARG PYTHON_VERSION=3.8.16 |
| 149 | +RUN set -ex \ |
| 150 | + && curl -L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer | bash \ |
| 151 | + && export PATH="$HOME/.pyenv/bin:$PATH" \ |
| 152 | + && pyenv update \ |
| 153 | + && pyenv install $PYTHON_VERSION \ |
| 154 | + && pyenv global $PYTHON_VERSION \ |
| 155 | + && pyenv rehash \ |
| 156 | + && echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc \ |
| 157 | + && echo 'command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc \ |
| 158 | + && echo 'eval "$(pyenv init -)"' >> ~/.bashrc |
| 159 | + |
| 160 | +# install llvm-toolset-7 to be able to install clang 5.0 |
| 161 | +# clang 5.0 is required to build pg_azure_storage project |
| 162 | +ENV LD_LIBRARY_PATH=/opt/rh/llvm-toolset-7/root/usr/lib64/:$LD_LIBRARY_PATH |
| 163 | +ENV PATH=/opt/rh/llvm-toolset-7/root/usr/bin:$PATH |
| 164 | + |
| 165 | +RUN touch /rpmlintrc \ |
| 166 | + && echo '%_build_pkgcheck %{_bindir}/rpmlint -f /rpmlintrc' >> /etc/rpm/macros |
| 167 | + |
| 168 | +# set PostgreSQL version, place scripts on path, and declare output volume |
| 169 | +ENV PGVERSION=17 \ |
| 170 | + PATH=/scripts:$PATH |
| 171 | +COPY scripts /scripts |
| 172 | +VOLUME /packages |
| 173 | + |
| 174 | +ENTRYPOINT ["/scripts/fetch_and_build_rpm"] |
0 commit comments