-
Notifications
You must be signed in to change notification settings - Fork 40
/
Dockerfile-postgres
37 lines (29 loc) · 1.55 KB
/
Dockerfile-postgres
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
FROM sibedge/postgres-plv8-bigint:15.2-3.1.6-bookworm
ENV POSTGRES_PASSWORD password
USER root
RUN apt-get update && \
apt-get -y install postgresql-15-postgis-3 postgresql-plpython3-15 git python3-boto3 make
WORKDIR /home/1001
#Clone forked AWS RDS S3-Extension mock called "chimpler"
RUN git clone https://github.com/mchrza/postgres-aws-s3.git --branch v.1.0.9 .
RUN make install
#Add mocked aws settings during initializiation phase
RUN echo "#!/bin/sh -e \n\
echo aws_s3.endpoint_url='http://localstack:4566' >> /var/lib/postgresql/data/postgresql.conf \n\
echo aws_s3.access_key_id='localstack' >> /var/lib/postgresql/data/postgresql.conf \n\
echo aws_s3.secret_access_key='localstack' >> /var/lib/postgresql/data/postgresql.conf \n\
psql -a -d postgres -U postgres -c \"SELECT pg_reload_conf();CREATE USER ro_user WITH PASSWORD 'password';GRANT pg_read_all_data TO ro_user;GRANT pg_write_server_files TO ro_user;\" > /dev/null \n\
psql -a -d postgres -U postgres -c \"CREATE DATABASE postgres_db2;\" > /dev/null \n\
" > /docker-entrypoint-initdb.d/cfg_s3_dummy.sh
RUN chmod 755 /docker-entrypoint-initdb.d/cfg_s3_dummy.sh
#Increase Database Loglevel
RUN echo "#!/bin/sh -e\n\
\n\n\
sed -i.org \
-e \"s/#log_min_messages = warning/log_min_messages = info/\" \
-e \"s/#log_min_error_statement = error/log_min_error_statement = info/\" \
-e \"s/#log_statement = 'none'/log_statement = 'all'/\" \
/var/lib/postgresql/data/postgresql.conf\n\n\
\n\n\
" > /docker-entrypoint-initdb.d/cfg_postgresql.conf.sh
RUN chmod 755 /docker-entrypoint-initdb.d/cfg_postgresql.conf.sh