-
Notifications
You must be signed in to change notification settings - Fork 28
/
opensuse15-postgres.dockerfile
31 lines (26 loc) · 1.2 KB
/
opensuse15-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
30
31
FROM opensuse/leap:15.1
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
RUN zypper install -r repo-oss -y python3
COPY files/docker/systemctl3.py /usr/bin/systemctl
RUN zypper --no-gpg-checks search -s postgresql
RUN zypper install -y postgresql-server postgresql-contrib
COPY files/docker/systemctl3.py /usr/bin/systemctl
## NOTE that PG=/var/lib/pgsql/data is created on the first 'start'
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 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 enable postgresql
CMD /usr/bin/systemctl