diff --git a/optional/postgresql/Dockerfile b/optional/postgresql/Dockerfile index dbfc1dc8..14d11864 100644 --- a/optional/postgresql/Dockerfile +++ b/optional/postgresql/Dockerfile @@ -16,8 +16,12 @@ COPY start.py /start.py COPY conf /conf ENV LANG en_US.UTF-8 + +RUN mkdir -p /var/lib/postgresql/data /run/postgresql \ + && chown -R postgres:postgres /var/lib/postgresql/data /run/postgresql \ + && chmod 2777 /run/postgresql + +VOLUME /var/lib/postgresql/data EXPOSE 5432 -RUN mkdir -p /run/postgresql && chown -R postgres:postgres /run/postgresql && chmod 2777 /run/postgresql - CMD /start.py diff --git a/optional/postgresql/start.py b/optional/postgresql/start.py index f8bfc7d9..5880765e 100755 --- a/optional/postgresql/start.py +++ b/optional/postgresql/start.py @@ -20,7 +20,7 @@ def setup(): conn.close() # Bootstrap the database if postgresql is running for the first time -if not os.path.exists('/var/lib/postgresql/data/pg_hba.conf'): +if not os.path.exists('/var/lib/postgresql/data/pg_wal'): os.system("chown -R postgres:postgres /var/lib/postgresql") os.system("su - postgres -c 'initdb -D /var/lib/postgresql/data'")