forked from CircleCI-Public/cimg-postgres
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
102 lines (90 loc) · 2.79 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# vim:set ft=dockerfile:
# 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.
# By policy, the base image tag should be a quarterly tag unless there's a
# specific reason to use a different one. This means January, April, July, or
# October.
FROM cimg/base:2023.04
LABEL maintainer="Community & Partner Engineering Team <[email protected]>"
ENV PG_VER=11.20
ENV PG_MAJOR=11
ENV POSTGRES_HOST_AUTH_METHOD=trust
ENV PATH /usr/lib/postgresql/$PG_MAJOR/bin:$PATH
ENV PGDATA /var/lib/postgresql/data
ENV POSTGRES_DB=circle_test
USER root
RUN apt-get update && apt-get install -y --no-install-recommends \
clang \
dirmngr \
gnupg \
gosu \
libclang-dev \
libicu-dev \
libipc-run-perl \
libkrb5-dev \
libldap2-dev \
liblz4-dev \
libpam-dev \
libperl-dev \
libpython3-dev \
libreadline-dev \
libssl-dev \
libxml2-dev \
libxslt1-dev \
llvm \
llvm-dev \
locales \
postgresql-server-dev-all \
python3-dev \
tcl-dev \
uuid-dev \
&& \
rm -rf /var/lib/apt/lists/* && \
localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8 && \
curl -sSL "https://ftp.postgresql.org/pub/source/v${PG_VER}/postgresql-${PG_VER}.tar.gz" | tar -xz && \
cd postgresql-${PG_VER} && \
./configure \
--prefix=/usr/lib/postgresql/$PG_MAJOR \
--enable-integer-datetimes \
--enable-thread-safety \
--enable-tap-tests \
--with-uuid=e2fs \
--with-gnu-ld \
--with-pgport=5432 \
--with-system-tzdata=/usr/share/zoneinfo \
--with-includes=/usr/local/include \
--with-libraries=/usr/local/lib \
--with-krb5 \
--with-gssapi \
--with-ldap \
--with-pam \
--with-tcl \
--with-perl \
--with-python \
--with-openssl \
--with-libxml \
--with-libxslt \
--with-icu \
--with-llvm \
--with-lz4 \
&& \
# we can change from world to world-bin in newer releases
make world && \
make install-world
# clones pg_cron extension for local use, this is not available wihout installing
# run this as a separate layer so it caches better
RUN git clone https://github.com/citusdata/pg_cron.git /pg_cron && \
cd /pg_cron && make && PATH=$PATH make install
RUN mkdir /docker-entrypoint-initdb.d
COPY pg_cron.sh /docker-entrypoint-initdb.d/
COPY custom-postgresql.conf /etc/postgresql/custom-postgresql.conf
COPY docker-entrypoint.sh /usr/local/bin/
RUN ln -s usr/local/bin/docker-entrypoint.sh / # backwards compat
RUN chmod +x /usr/local/bin/docker-entrypoint.sh /docker-entrypoint-initdb.d/pg_cron.sh
RUN mkdir -p /var/lib/postgresql && \
chown -R postgres:postgres /var/lib/postgresql && \
chown -R postgres:postgres /usr/local/bin/docker-entrypoint.sh && \
rm -rf /pg_cron
ENTRYPOINT ["docker-entrypoint.sh"]
STOPSIGNAL SIGINT
EXPOSE 5432
CMD ["postgres"]