|
| 1 | +# vim:set ft=dockerfile: |
| 2 | + |
| 3 | +# Do not edit individual Dockerfiles manually. Instead, please make changes to the Dockerfile.template, which will be used by the build script to generate Dockerfiles. |
| 4 | + |
| 5 | +# By policy, the base image tag should be a quarterly tag unless there's a |
| 6 | +# specific reason to use a different one. This means January, April, July, or |
| 7 | +# October. |
| 8 | + |
| 9 | +FROM cimg/base:2023.07 |
| 10 | + |
| 11 | +LABEL maintainer= "Community & Partner Engineering Team <[email protected]>" |
| 12 | + |
| 13 | +ENV PG_VER=16.0 |
| 14 | +ENV PG_MAJOR=16 |
| 15 | +ENV POSTGRES_HOST_AUTH_METHOD=trust |
| 16 | +ENV PATH /usr/lib/postgresql/$PG_MAJOR/bin:$PATH |
| 17 | +ENV PGDATA /var/lib/postgresql/data |
| 18 | +ENV POSTGRES_DB=circle_test |
| 19 | +ENV PGTAP_VERSION 1.2.0 |
| 20 | +ENV PARTMAN_VERSION 4.7.2 |
| 21 | + |
| 22 | +USER root |
| 23 | +RUN BUILD_DEPS="clang \ |
| 24 | + dirmngr \ |
| 25 | + gnupg \ |
| 26 | + libclang-dev \ |
| 27 | + libicu-dev \ |
| 28 | + libipc-run-perl \ |
| 29 | + libkrb5-dev \ |
| 30 | + libldap2-dev \ |
| 31 | + liblz4-dev \ |
| 32 | + libpam-dev \ |
| 33 | + libperl-dev \ |
| 34 | + libpython3-dev \ |
| 35 | + libreadline-dev \ |
| 36 | + libssl-dev \ |
| 37 | + libxml2-dev \ |
| 38 | + libxslt1-dev \ |
| 39 | + llvm \ |
| 40 | + llvm-dev \ |
| 41 | + postgresql-server-dev-all \ |
| 42 | + python3-dev \ |
| 43 | + tcl-dev \ |
| 44 | + uuid-dev" && \ |
| 45 | + apt-get update && apt-get install -y --no-install-recommends \ |
| 46 | + gosu \ |
| 47 | + locales \ |
| 48 | + $BUILD_DEPS \ |
| 49 | + && \ |
| 50 | + rm -rf /var/lib/apt/lists/* && \ |
| 51 | + localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8 && \ |
| 52 | + curl -sSL "https://ftp.postgresql.org/pub/source/v${PG_VER}/postgresql-${PG_VER}.tar.gz" | tar -xz && \ |
| 53 | + cd postgresql-${PG_VER} && \ |
| 54 | + ./configure \ |
| 55 | + --prefix=/usr/lib/postgresql/$PG_MAJOR \ |
| 56 | + --enable-integer-datetimes \ |
| 57 | + --enable-thread-safety \ |
| 58 | + --enable-tap-tests \ |
| 59 | + --with-uuid=e2fs \ |
| 60 | + --with-gnu-ld \ |
| 61 | + --with-pgport=5432 \ |
| 62 | + --with-system-tzdata=/usr/share/zoneinfo \ |
| 63 | + --with-includes=/usr/local/include \ |
| 64 | + --with-libraries=/usr/local/lib \ |
| 65 | + --with-krb5 \ |
| 66 | + --with-gssapi \ |
| 67 | + --with-ldap \ |
| 68 | + --with-pam \ |
| 69 | + --with-tcl \ |
| 70 | + --with-perl \ |
| 71 | + --with-python \ |
| 72 | + --with-openssl \ |
| 73 | + --with-libxml \ |
| 74 | + --with-libxslt \ |
| 75 | + --with-icu \ |
| 76 | + --with-llvm \ |
| 77 | + --with-lz4 \ |
| 78 | + && \ |
| 79 | + # we can change from world to world-bin in newer releases |
| 80 | + make -j $(nproc) world && \ |
| 81 | + make install-world && \ |
| 82 | + cd .. && rm -rf postgresql-${PG_VER} \ |
| 83 | + && \ |
| 84 | + git clone --depth 1 https://github.com/citusdata/pg_cron.git /pg_cron && \ |
| 85 | + cd /pg_cron && make && PATH=$PATH make install && \ |
| 86 | + rm -rf /pg_cron && \ |
| 87 | + apt-get purge -y --auto-remove $BUILD_DEPS |
| 88 | + |
| 89 | +RUN curl -sSL "https://github.com/pgpartman/pg_partman/archive/v${PARTMAN_VERSION}.tar.gz" | tar -xz && \ |
| 90 | + cd pg_partman-${PARTMAN_VERSION} && make NO_BGW=1 install && \ |
| 91 | + cd .. && rm -rf pg_partman-${PARTMAN_VERSION} |
| 92 | + |
| 93 | +# Install pgTAP & pg_prove utility. |
| 94 | +RUN git clone --depth 1 -b "v$PGTAP_VERSION" https://github.com/theory/pgtap.git /pgtap && \ |
| 95 | + cd /pgtap && make -j $(nproc) && make install && \ |
| 96 | + curl -sL https://cpanmin.us | perl - App::cpanminus && \ |
| 97 | + cpanm -n TAP::Parser::SourceHandler::pgTAP && \ |
| 98 | + rm -rf /pgtap |
| 99 | + |
| 100 | +RUN mkdir /docker-entrypoint-initdb.d |
| 101 | + |
| 102 | +COPY pg_cron.sh /docker-entrypoint-initdb.d/ |
| 103 | +COPY custom-postgresql.conf /etc/postgresql/custom-postgresql.conf |
| 104 | +COPY docker-entrypoint.sh /usr/local/bin/ |
| 105 | + |
| 106 | +# Backwards compatibility |
| 107 | +RUN ln -s usr/local/bin/docker-entrypoint.sh / |
| 108 | + |
| 109 | +RUN chmod +x /usr/local/bin/docker-entrypoint.sh /docker-entrypoint-initdb.d/pg_cron.sh && \ |
| 110 | + mkdir -p /var/lib/postgresql && \ |
| 111 | + chown -R postgres:postgres /var/lib/postgresql && \ |
| 112 | + chown -R postgres:postgres /etc/postgresql && \ |
| 113 | + chown -R postgres:postgres /usr/local/bin/docker-entrypoint.sh |
| 114 | + |
| 115 | +ENTRYPOINT ["docker-entrypoint.sh"] |
| 116 | +STOPSIGNAL SIGINT |
| 117 | +EXPOSE 5432 |
| 118 | +CMD ["postgres"] |
0 commit comments