@@ -16,6 +16,7 @@ ENV POSTGRES_HOST_AUTH_METHOD=trust
16
16
ENV PATH /usr/lib/postgresql/$PG_MAJOR/bin:$PATH
17
17
ENV PGDATA /var/lib/postgresql/data
18
18
ENV POSTGRES_DB=circle_test
19
+ ENV PGTAP_VERSION 1.2.0
19
20
20
21
USER root
21
22
RUN apt-get update && apt-get install -y --no-install-recommends \
@@ -79,22 +80,30 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
79
80
80
81
# clones pg_cron extension for local use, this is not available wihout installing
81
82
# run this as a separate layer so it caches better
82
- RUN git clone https://github.com/citusdata/pg_cron.git /pg_cron && \
83
+ RUN git clone --depth 1 https://github.com/citusdata/pg_cron.git /pg_cron && \
83
84
cd /pg_cron && make && PATH=$PATH make install
84
85
85
- RUN mkdir /docker-entrypoint-initdb.d
86
+ # Install pgTAP & pg_prove utility.
87
+ RUN git clone --depth 1 -b "v$PGTAP_VERSION" https://github.com/theory/pgtap.git /pgtap && \
88
+ cd /pgtap && make && make install && \
89
+ curl -sL https://cpanmin.us | perl - App::cpanminus && \
90
+ cpanm -n TAP::Parser::SourceHandler::pgTAP
86
91
92
+ # Enable extensions
93
+ RUN mkdir /docker-entrypoint-initdb.d && \
94
+ echo "CREATE EXTENSION pgtap;" > /docker-entrypoint-initdb.d/pgtap.sql
87
95
COPY pg_cron.sh /docker-entrypoint-initdb.d/
96
+
88
97
COPY custom-postgresql.conf /etc/postgresql/custom-postgresql.conf
89
98
COPY docker-entrypoint.sh /usr/local/bin/
99
+ # Backwards compatibility
100
+ RUN ln -s usr/local/bin/docker-entrypoint.sh /
90
101
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 && \
102
+ RUN chmod +x /usr/local/bin/docker-entrypoint.sh /docker-entrypoint-initdb.d/pg_cron.sh && \
103
+ mkdir -p /var/lib/postgresql && \
95
104
chown -R postgres:postgres /var/lib/postgresql && \
96
105
chown -R postgres:postgres /usr/local/bin/docker-entrypoint.sh && \
97
- rm -rf /pg_cron
106
+ rm -rf /pg_cron /pgtap
98
107
99
108
ENTRYPOINT ["docker-entrypoint.sh" ]
100
109
STOPSIGNAL SIGINT
0 commit comments