diff --git a/docker/database/Dockerfile b/docker/database/Dockerfile index c726e2fbe..7f32b3a5a 100644 --- a/docker/database/Dockerfile +++ b/docker/database/Dockerfile @@ -3,11 +3,13 @@ FROM docker.io/postgres:12 # Allow for connecting to database without password authentication ENV POSTGRES_HOST_AUTH_METHOD=trust -RUN cp /mnt/fradrive/docker/database/pg_hba.conf /docker-entrypoint-initdb.d/pg_hba.conf && chown postgres:postgres /docker-entrypoint-initdb.d/pg_hba.conf -RUN cp /mnt/fradrive/docker/database/postgresql.conf /docker-entrypoint-initdb.d/postgresql.conf && chown postgres:postgres /docker-entrypoint-initdb.d/postgresql.conf +COPY --chown=postgres:postgres docker/database/pg_hba.conf /tmp/pg_hba.conf +COPY --chown=postgres:postgres docker/database/postgresql.conf /tmp/postgresql.conf +COPY docker/database/pgconfig.sh /docker-entrypoint-initdb.d/_pgconfig.sh +COPY --chown=postgres:postgres docker/database/schema.sql /docker-entrypoint-initdb.d/schema.sql -RUN cp /mnt/fradrive/docker/database/schema.sql /schema.sql && chown postgres:postgres /schema.sql -RUN cp /mnt/fradrive/docker/database/initdb.sh /etc/fradrive-db && chmod 755 /etc/fradrive-db +# RUN cp /mnt/fradrive/docker/database/schema.sql /schema.sql && chown postgres:postgres /schema.sql +# RUN cp /mnt/fradrive/docker/database/initdb.sh /etc/fradrive-db && chmod 755 /etc/fradrive-db USER postgres @@ -17,5 +19,4 @@ USER postgres # ADD ./schema.sql /schema.sql # ADD --chmod=755 ./initdb.sh /etc/fradrive-db -ENTRYPOINT /etc/fradrive-db EXPOSE 5432/tcp \ No newline at end of file diff --git a/docker/database/pgconfig.sh b/docker/database/pgconfig.sh new file mode 100755 index 000000000..fbed96fe0 --- /dev/null +++ b/docker/database/pgconfig.sh @@ -0,0 +1,6 @@ +#!/usr/bin/env bash + +cat /tmp/pg_hba.conf > /var/lib/postgresql/data/pg_hba.conf +cat /tmp/postgresql.conf > /var/lib/postgresql/data/postgresql.conf + +echo "Custom pg_hba.conf and postgresql.conf successfully deployed." \ No newline at end of file