1
+ FROM postgres:12
2
+
3
+ # Dependencies
4
+ RUN apt-get update && apt-get install -y \
5
+ build-essential \
6
+ git \
7
+ wget \
8
+ postgresql-server-dev-12 \
9
+ && rm -rf /var/lib/apt/lists/*
10
+
11
+ # Postgres Docker Images copy contents of postgresql.conf.sample to postgresql.conf during initialization
12
+ # COPY custom.conf /usr/share/postgresql/postgresql.conf.sample -- DO NOT USE
13
+ RUN echo "shared_preload_libraries = 'pg_stat_statements,pg_wait_sampling,pg_stat_monitor'" >> /usr/share/postgresql/postgresql.conf.sample
14
+ RUN echo "pg_stat_statements.track = all" >> /usr/share/postgresql/postgresql.conf.sample
15
+ RUN echo "pg_stat_statements.save = on" >> /usr/share/postgresql/postgresql.conf.sample
16
+ RUN echo "pg_stat_monitor.pgsm_enable_query_plan = on" >> /usr/share/postgresql/postgresql.conf.sample
17
+
18
+ # Install pg_wait_sampling
19
+ RUN git clone https://github.com/postgrespro/pg_wait_sampling.git \
20
+ && cd pg_wait_sampling \
21
+ && make USE_PGXS=1 \
22
+ && make USE_PGXS=1 install \
23
+ && cd .. \
24
+ && rm -rf pg_wait_sampling
25
+
26
+ # Install pg_stat_monitor
27
+ RUN git clone https://github.com/percona/pg_stat_monitor.git \
28
+ && cd pg_stat_monitor \
29
+ && make USE_PGXS=1 \
30
+ && make USE_PGXS=1 install \
31
+ && cd .. \
32
+ && rm -rf pg_stat_monitor
33
+
34
+ # Download the titanic database
35
+ RUN wget https://raw.githubusercontent.com/neondatabase/postgres-sample-dbs/main/titanic.sql -P /docker-entrypoint-initdb.d/
36
+
37
+ RUN echo ${PWD} && ls -lR
38
+
39
+ # Enable the extensions and setup the titanic database
40
+ COPY 01-init-extensions.sql /docker-entrypoint-initdb.d/01-init-extensions.sql
41
+ COPY 02-create-database.sql /docker-entrypoint-initdb.d/02-create-database.sql
42
+ COPY 03-import-data.sql /docker-entrypoint-initdb.d/03-import-data.sql
0 commit comments