Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 1479b87

Browse files
committed
User persistent storage
1 parent aacf203 commit 1479b87

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

Dockerfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,5 @@ RUN rm /usr/sbin/policy-rc.d
1616

1717
ADD . /usr/bin
1818
RUN chmod +x /usr/bin/start_pgsql.sh
19+
RUN echo 'host all all 0.0.0.0/0 md5' >> /etc/postgresql/9.1/main/pg_hba.conf
20+
RUN sed -i -e"s/var\/lib/opt/g" /etc/postgresql/9.1/main/postgresql.conf

start_pgsql.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
#!/bin/bash
22
# forked from https://gist.github.com/jpetazzo/5494158
33

4-
echo 'host all all 0.0.0.0/0 md5' >> /etc/postgresql/9.1/main/pg_hba.conf
4+
mkdir -p /opt/postgresql
5+
cp -a /var/lib/postgresql/* /opt/postgresql/
6+
chown -R postgres:postgres /opt/postgresql
57
su postgres sh -c "/usr/lib/postgresql/9.1/bin/postgres --single -D /var/lib/postgresql/9.1/main -c config_file=/etc/postgresql/9.1/main/postgresql.conf" <<< "CREATE USER root WITH SUPERUSER PASSWORD '$1';"
68
su postgres sh -c "/usr/lib/postgresql/9.1/bin/postgres --single -D /var/lib/postgresql/9.1/main -c config_file=/etc/postgresql/9.1/main/postgresql.conf" <<< "CREATE DATABASE db;"
79
su postgres sh -c "/usr/lib/postgresql/9.1/bin/postgres -D /var/lib/postgresql/9.1/main -c config_file=/etc/postgresql/9.1/main/postgresql.conf -c listen_addresses=*"

0 commit comments

Comments
 (0)