From 6901d10d54c51f8e4038e6c6d850a86cecf2e885 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sandro=20J=C3=A4ckel?= Date: Sun, 31 May 2020 09:57:33 +0200 Subject: [PATCH] Set magic ENV varialbes for user, default DB instead of doing it ourselves --- docker-compose.yml | 4 ++++ docker/Dockerfile.postgres | 1 - docker/entrypoint.postgres.sh | 2 -- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index d7b3fa913..4b78f3bc3 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -7,6 +7,10 @@ services: restart: unless-stopped volumes: - postgresdata:/var/lib/postgresql/data + environment: + POSTGRES_DB: invidious + POSTGRES_PASSWORD: kemal + POSTGRES_USER: kemal healthcheck: test: ["CMD", "pg_isready", "-U", "postgres"] invidious: diff --git a/docker/Dockerfile.postgres b/docker/Dockerfile.postgres index 3b25b8020..19b046674 100644 --- a/docker/Dockerfile.postgres +++ b/docker/Dockerfile.postgres @@ -1,6 +1,5 @@ FROM postgres:10 -ENV POSTGRES_USER postgres # Do not require a PostgreSQL superuser password. # See https://github.com/docker-library/postgres/issues/681. ENV POSTGRES_HOST_AUTH_METHOD trust diff --git a/docker/entrypoint.postgres.sh b/docker/entrypoint.postgres.sh index be6f6782a..13f6ea7dc 100755 --- a/docker/entrypoint.postgres.sh +++ b/docker/entrypoint.postgres.sh @@ -10,8 +10,6 @@ if [ ! -f /var/lib/postgresql/data/setupFinished ]; then sleep 5 done >&2 echo "### importing table schemas" - su postgres -c 'createdb invidious' - su postgres -c 'psql -c "CREATE USER kemal WITH PASSWORD '"'kemal'"'"' su postgres -c 'psql invidious kemal < config/sql/channels.sql' su postgres -c 'psql invidious kemal < config/sql/videos.sql' su postgres -c 'psql invidious kemal < config/sql/channel_videos.sql'