Declare the data volume properly

master
Tim Möhlmann 6 years ago
parent 79246cf2a3
commit a2b5b4d2e0
No known key found for this signature in database
GPG Key ID: 8677988D8072E8DE

@ -16,8 +16,12 @@ COPY start.py /start.py
COPY conf /conf COPY conf /conf
ENV LANG en_US.UTF-8 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 EXPOSE 5432
RUN mkdir -p /run/postgresql && chown -R postgres:postgres /run/postgresql && chmod 2777 /run/postgresql
CMD /start.py CMD /start.py

@ -20,7 +20,7 @@ def setup():
conn.close() conn.close()
# Bootstrap the database if postgresql is running for the first time # 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("chown -R postgres:postgres /var/lib/postgresql")
os.system("su - postgres -c 'initdb -D /var/lib/postgresql/data'") os.system("su - postgres -c 'initdb -D /var/lib/postgresql/data'")

Loading…
Cancel
Save