diff --git a/postgres_15/Dockerfile b/postgres_15/Dockerfile index 3a8601ec4..638d9dcb2 100644 --- a/postgres_15/Dockerfile +++ b/postgres_15/Dockerfile @@ -121,4 +121,4 @@ HEALTHCHECK \ --retries=5 \ --start-period=90s \ --timeout=25s \ - CMD pg_isready --dbname="${POSTGRES_DB}" --username="${POSTGRES_USER}" || exit 1 + CMD /usr/local/bin/healthcheck.sh diff --git a/postgres_15/rootfs/usr/local/bin/healthcheck.sh b/postgres_15/rootfs/usr/local/bin/healthcheck.sh new file mode 100644 index 000000000..cd04f7518 --- /dev/null +++ b/postgres_15/rootfs/usr/local/bin/healthcheck.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env bashio +# shellcheck shell=bash + +POSTGRES_USER="$(bashio::config "POSTGRES_USER" "postgres")" +POSTGRES_DB="$(bashio::config "POSTGRES_DB" "$POSTGRES_USER")" + +pg_isready --dbname="${POSTGRES_DB}" --username="${POSTGRES_USER}" || exit $?; \ No newline at end of file diff --git a/postgres_17/rootfs/usr/local/bin/healthcheck.sh b/postgres_17/rootfs/usr/local/bin/healthcheck.sh new file mode 100644 index 000000000..cd04f7518 --- /dev/null +++ b/postgres_17/rootfs/usr/local/bin/healthcheck.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env bashio +# shellcheck shell=bash + +POSTGRES_USER="$(bashio::config "POSTGRES_USER" "postgres")" +POSTGRES_DB="$(bashio::config "POSTGRES_DB" "$POSTGRES_USER")" + +pg_isready --dbname="${POSTGRES_DB}" --username="${POSTGRES_USER}" || exit $?; \ No newline at end of file