-
Notifications
You must be signed in to change notification settings - Fork 28
/
centos7-postgres.dockerfile
29 lines (24 loc) · 1.06 KB
/
centos7-postgres.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
FROM centos:7.9.2009
LABEL __copyright__="(C) Guido U. Draheim, licensed under the EUPL" \
__version__="1.5.8065"
ENV PG /var/lib/pgsql/data
ARG USERNAME=testuser_OK
ARG TESTUSER=testuser_11
ARG LISTEN=*
ARG ALLOWS=0.0.0.0/0
EXPOSE 5432
COPY files/docker/systemctl.py /usr/bin/systemctl
RUN yum install -y postgresql-server postgresql-utils
COPY files/docker/systemctl.py /usr/bin/systemctl
RUN postgresql-setup initdb
RUN sed -i -e "s/.*listen_addresses.*/listen_addresses = '${LISTEN}'/" $PG/postgresql.conf
RUN sed -i -e "s/.*host.*ident/# &/" $PG/pg_hba.conf
RUN echo "host all all ${ALLOWS} md5" >> $PG/pg_hba.conf
RUN systemctl start postgresql \
; echo "CREATE USER ${TESTUSER} LOGIN ENCRYPTED PASSWORD '${TESTPASS}'" | runuser -u postgres /usr/bin/psql \
; echo "CREATE USER ${USERNAME} LOGIN ENCRYPTED PASSWORD '${PASSWORD}'" | runuser -u postgres /usr/bin/psql \
; systemctl stop postgresql
RUN systemctl enable postgresql
CMD /usr/bin/systemctl