diff --git a/pkg/docker/Dockerfile b/pkg/docker/Dockerfile index 9dc57b95b..d1910adad 100644 --- a/pkg/docker/Dockerfile +++ b/pkg/docker/Dockerfile @@ -97,6 +97,10 @@ RUN set -eux; \ echo 'if [ "${1#-}" != "$1" ] || [ "${1%.conf}" != "$1" ]; then' >> /usr/local/bin/docker-entrypoint.sh; \ echo ' set -- keydb-server "$@"' >> /usr/local/bin/docker-entrypoint.sh; \ echo 'fi' >> /usr/local/bin/docker-entrypoint.sh; \ + echo '# if KEYDB_PASSWORD is set, add it to the arguments' >> /usr/local/bin/docker-entrypoint.sh; \ + echo 'if [ -n "$KEYDB_PASSWORD" ]; then' >> /usr/local/bin/docker-entrypoint.sh; \ + echo ' set -- "$@" --requirepass "${KEYDB_PASSWORD}"' >> /usr/local/bin/docker-entrypoint.sh; \ + echo 'fi' >> /usr/local/bin/docker-entrypoint.sh; \ echo "# allow the container to be started with `--user`" >> /usr/local/bin/docker-entrypoint.sh; \ echo 'if [ "$1" = "keydb-server" -a "$(id -u)" = "0" ]; then' >> /usr/local/bin/docker-entrypoint.sh; \ echo " find . \! -user keydb -exec chown keydb '{}' +" >> /usr/local/bin/docker-entrypoint.sh; \ diff --git a/pkg/docker/Dockerfile_Alpine b/pkg/docker/Dockerfile_Alpine index 028fea3a5..7ff44a1df 100644 --- a/pkg/docker/Dockerfile_Alpine +++ b/pkg/docker/Dockerfile_Alpine @@ -68,6 +68,10 @@ RUN set -eux; \ echo 'if [ "${1#-}" != "$1" ] || [ "${1%.conf}" != "$1" ]; then' >> /usr/local/bin/docker-entrypoint.sh; \ echo ' set -- keydb-server "$@"' >> /usr/local/bin/docker-entrypoint.sh; \ echo 'fi' >> /usr/local/bin/docker-entrypoint.sh; \ + echo '# if KEYDB_PASSWORD is set, add it to the arguments' >> /usr/local/bin/docker-entrypoint.sh; \ + echo 'if [ -n "$KEYDB_PASSWORD" ]; then' >> /usr/local/bin/docker-entrypoint.sh; \ + echo ' set -- "$@" --requirepass "${KEYDB_PASSWORD}"' >> /usr/local/bin/docker-entrypoint.sh; \ + echo 'fi' >> /usr/local/bin/docker-entrypoint.sh; \ echo "# allow the container to be started with `--user`" >> /usr/local/bin/docker-entrypoint.sh; \ echo 'if [ "$1" = "keydb-server" -a "$(id -u)" = "0" ]; then' >> /usr/local/bin/docker-entrypoint.sh; \ echo " find . \! -user keydb -exec chown keydb '{}' +" >> /usr/local/bin/docker-entrypoint.sh; \