|
| 1 | +# vim:set ft=dockerfile: |
| 2 | +FROM ubuntu:noble |
| 3 | +ARG DEBIAN_FRONTEND=noninteractive |
| 4 | + |
| 5 | +# See https://github.com/tianon/docker-brew-debian/issues/49 for discussion of the following |
| 6 | +# |
| 7 | +# https://bugs.debian.org/830696 (apt uses gpgv by default in newer releases, rather than gpg) |
| 8 | +RUN set -x \ |
| 9 | + && apt-get update \ |
| 10 | +# Fix ipv6 issue on travis: https://github.com/f-secure-foundry/usbarmory-debian-base_image/issues/9#issuecomment-466594168 |
| 11 | + && mkdir ~/.gnupg && echo "disable-ipv6" >> ~/.gnupg/dirmngr.conf \ |
| 12 | + && { \ |
| 13 | + which gpg \ |
| 14 | +# prefer gnupg2, to match APT's Recommends |
| 15 | + || apt-get install -y --no-install-recommends gnupg2 \ |
| 16 | + || apt-get install -y --no-install-recommends gnupg \ |
| 17 | + ; } \ |
| 18 | +# Ubuntu includes "gnupg" (not "gnupg2", but still 2.x), but not dirmngr, and gnupg 2.x requires dirmngr |
| 19 | +# so, if we're not running gnupg 1.x, explicitly install dirmngr too |
| 20 | + && { \ |
| 21 | + gpg --version | grep -q '^gpg (GnuPG) 1\.' \ |
| 22 | + || apt-get install -y --no-install-recommends dirmngr \ |
| 23 | + ; } \ |
| 24 | + && rm -rf /var/lib/apt/lists/* |
| 25 | + |
| 26 | +RUN set -ex; \ |
| 27 | +# pub 4096R/ACCC4CF8 2011-10-13 [expires: 2019-07-02] |
| 28 | +# Key fingerprint = B97B 0AFC AA1A 47F0 44F2 44A0 7FCC 7D46 ACCC 4CF8 |
| 29 | +# uid PostgreSQL Debian Repository |
| 30 | + key='B97B0AFCAA1A47F044F244A07FCC7D46ACCC4CF8'; \ |
| 31 | + export GNUPGHOME="$(mktemp -d)"; \ |
| 32 | +# Fix ipv6 issue on travis: https://github.com/f-secure-foundry/usbarmory-debian-base_image/issues/9#issuecomment-466594168 |
| 33 | + echo "disable-ipv6" >> $GNUPGHOME/dirmngr.conf; \ |
| 34 | + gpg --batch --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys "$key"; \ |
| 35 | + gpg --batch --export "$key" > /etc/apt/trusted.gpg.d/postgres.gpg; \ |
| 36 | + command -v gpgconf > /dev/null && gpgconf --kill all; \ |
| 37 | + rm -rf "$GNUPGHOME"; \ |
| 38 | + apt-key list |
| 39 | + |
| 40 | +# add buster backports repo to be able to download missing packages in buster main repo |
| 41 | +RUN ( [ ubuntu != debian ] || [ noble != buster ] ) || ( \ |
| 42 | + echo "deb http://deb.debian.org/debian buster-backports main" >> /etc/apt/sources.list \ |
| 43 | + ) |
| 44 | + |
| 45 | +# install build tools and PostgreSQL development files |
| 46 | + |
| 47 | +RUN echo 'deb http://apt.postgresql.org/pub/repos/apt/ noble-pgdg main 17' > /etc/apt/sources.list.d/pgdg.list \ |
| 48 | + && apt-get update \ |
| 49 | + && apt-get install -y --no-install-recommends \ |
| 50 | + autotools-dev \ |
| 51 | + build-essential \ |
| 52 | + ca-certificates \ |
| 53 | + curl \ |
| 54 | + debhelper \ |
| 55 | + devscripts \ |
| 56 | + fakeroot \ |
| 57 | + flex \ |
| 58 | + libbz2-dev \ |
| 59 | + libffi-dev \ |
| 60 | + libcurl4-openssl-dev \ |
| 61 | + libdistro-info-perl \ |
| 62 | + libedit-dev \ |
| 63 | + libfile-fcntllock-perl \ |
| 64 | + libicu-dev \ |
| 65 | + libkrb5-dev \ |
| 66 | + libpam0g-dev \ |
| 67 | + libreadline-dev \ |
| 68 | + libselinux1-dev \ |
| 69 | + libssl-dev \ |
| 70 | + libxslt-dev \ |
| 71 | + lintian \ |
| 72 | + postgresql-server-dev-all \ |
| 73 | + postgresql-server-dev-17 \ |
| 74 | + wget \ |
| 75 | + zlib1g-dev \ |
| 76 | + python3-pip \ |
| 77 | + python3-sphinx \ |
| 78 | + python3-setuptools \ |
| 79 | + liblz4-dev \ |
| 80 | + liblz4-1 \ |
| 81 | + libzstd1 \ |
| 82 | + libzstd-dev \ |
| 83 | +# below are needed for cmake and pgazure build |
| 84 | + checkinstall \ |
| 85 | + git \ |
| 86 | + libtemplate-perl \ |
| 87 | + pkg-config \ |
| 88 | + tar \ |
| 89 | + unzip \ |
| 90 | + uuid \ |
| 91 | + uuid-dev \ |
| 92 | + zip \ |
| 93 | + sudo \ |
| 94 | + && rm -rf /var/lib/apt/lists/* |
| 95 | + |
| 96 | + |
| 97 | +# install jq to process JSON API responses |
| 98 | +RUN curl -sL https://github.com/stedolan/jq/releases/download/jq-1.5/jq-linux64 \ |
| 99 | + -o /usr/bin/jq \ |
| 100 | + && chmod +x /usr/bin/jq |
| 101 | + |
| 102 | +# install packagecloud repos for pg_auto_failover |
| 103 | +RUN curl https://install.citusdata.com/community/deb.sh | bash \ |
| 104 | + && rm -rf /var/lib/apt/lists/* |
| 105 | + |
| 106 | +# patch pg_buildext to use multiple processors |
| 107 | +COPY make_pg_buildext_parallel.patch / |
| 108 | +RUN patch `which pg_buildext` < /make_pg_buildext_parallel.patch |
| 109 | + |
| 110 | + |
| 111 | +# install cmake from source |
| 112 | +RUN wget https://github.com/Kitware/CMake/releases/download/v3.22.2/cmake-3.22.2.tar.gz && \ |
| 113 | + tar -zxvf cmake-3.22.2.tar.gz && \ |
| 114 | + cd cmake-3.22.2 && ./bootstrap && \ |
| 115 | + make && \ |
| 116 | + make install && \ |
| 117 | + rm -f cmake-3.22.2.tar.gz && \ |
| 118 | + rm -rf cmake-3.22.2 |
| 119 | + |
| 120 | +# install pyenv and python 3.8 to be able to execute tools scripts |
| 121 | +ARG PYTHON_VERSION=3.8.16 |
| 122 | +RUN set -ex \ |
| 123 | + && curl -L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer | bash \ |
| 124 | + && export PATH="$HOME/.pyenv/bin:$PATH" \ |
| 125 | + && pyenv update \ |
| 126 | + && pyenv install $PYTHON_VERSION \ |
| 127 | + && pyenv global $PYTHON_VERSION \ |
| 128 | + && pyenv rehash \ |
| 129 | + && echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc \ |
| 130 | + && echo 'command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc \ |
| 131 | + && echo 'eval "$(pyenv init -)"' >> ~/.bashrc |
| 132 | + |
| 133 | + |
| 134 | +# Added for pg17 beta package support. |
| 135 | +ENV DEB_PG_SUPPORTED_VERSIONS="10 11 12 13 14 15 16 17" |
| 136 | + |
| 137 | +# place scripts on path and declare output volume |
| 138 | +ENV PATH /scripts:$PATH |
| 139 | +COPY scripts /scripts |
| 140 | +VOLUME /packages |
| 141 | + |
| 142 | +ENTRYPOINT ["/scripts/fetch_and_build_deb"] |
0 commit comments