|
| 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.04 |
| 10 | + |
| 11 | +LABEL maintainer="Community & Partner Engineering Team <community-partner@circleci.com>" |
| 12 | + |
| 13 | +ENV PG_VER=11.20 |
| 14 | +ENV PG_MAJOR=11 |
| 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 | + |
| 20 | +USER root |
| 21 | +RUN apt-get update && apt-get install -y --no-install-recommends \ |
| 22 | + clang \ |
| 23 | + dirmngr \ |
| 24 | + gnupg \ |
| 25 | + gosu \ |
| 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 | + locales \ |
| 42 | + postgresql-server-dev-all \ |
| 43 | + python3-dev \ |
| 44 | + tcl-dev \ |
| 45 | + uuid-dev \ |
| 46 | + && \ |
| 47 | + rm -rf /var/lib/apt/lists/* && \ |
| 48 | + localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8 && \ |
| 49 | + curl -sSL "https://ftp.postgresql.org/pub/source/v${PG_VER}/postgresql-${PG_VER}.tar.gz" | tar -xz && \ |
| 50 | + cd postgresql-${PG_VER} && \ |
| 51 | + ./configure \ |
| 52 | + --prefix=/usr/lib/postgresql/$PG_MAJOR \ |
| 53 | + --enable-integer-datetimes \ |
| 54 | + --enable-thread-safety \ |
| 55 | + --enable-tap-tests \ |
| 56 | + --with-uuid=e2fs \ |
| 57 | + --with-gnu-ld \ |
| 58 | + --with-pgport=5432 \ |
| 59 | + --with-system-tzdata=/usr/share/zoneinfo \ |
| 60 | + --with-includes=/usr/local/include \ |
| 61 | + --with-libraries=/usr/local/lib \ |
| 62 | + --with-krb5 \ |
| 63 | + --with-gssapi \ |
| 64 | + --with-ldap \ |
| 65 | + --with-pam \ |
| 66 | + --with-tcl \ |
| 67 | + --with-perl \ |
| 68 | + --with-python \ |
| 69 | + --with-openssl \ |
| 70 | + --with-libxml \ |
| 71 | + --with-libxslt \ |
| 72 | + --with-icu \ |
| 73 | + --with-llvm \ |
| 74 | + --with-lz4 \ |
| 75 | + && \ |
| 76 | + # we can change from world to world-bin in newer releases |
| 77 | + make world && \ |
| 78 | + make install-world |
| 79 | + |
| 80 | +# clones pg_cron extension for local use, this is not available wihout installing |
| 81 | +# run this as a separate layer so it caches better |
| 82 | +RUN git clone https://github.com/citusdata/pg_cron.git /pg_cron && \ |
| 83 | + cd /pg_cron && make && PATH=$PATH make install |
| 84 | + |
| 85 | +RUN mkdir /docker-entrypoint-initdb.d |
| 86 | + |
| 87 | +COPY pg_cron.sh /docker-entrypoint-initdb.d/ |
| 88 | +COPY custom-postgresql.conf /etc/postgresql/custom-postgresql.conf |
| 89 | +COPY docker-entrypoint.sh /usr/local/bin/ |
| 90 | + |
| 91 | +RUN ln -s usr/local/bin/docker-entrypoint.sh / # backwards compat |
| 92 | + |
| 93 | +RUN chmod +x /usr/local/bin/docker-entrypoint.sh /docker-entrypoint-initdb.d/pg_cron.sh |
| 94 | +RUN mkdir -p /var/lib/postgresql && \ |
| 95 | + chown -R postgres:postgres /var/lib/postgresql && \ |
| 96 | + chown -R postgres:postgres /usr/local/bin/docker-entrypoint.sh && \ |
| 97 | + rm -rf /pg_cron |
| 98 | + |
| 99 | +ENTRYPOINT ["docker-entrypoint.sh"] |
| 100 | +STOPSIGNAL SIGINT |
| 101 | +EXPOSE 5432 |
| 102 | +CMD ["postgres"] |
0 commit comments