From 7262250b6012dcb4def22300020ef6f39941dec6 Mon Sep 17 00:00:00 2001 From: iamabhishek-dubey Date: Mon, 16 Mar 2020 23:05:02 +0530 Subject: [PATCH] Added entrypoint.sh to support cluster and standalone --- Dockerfile | 6 ++---- entrypoint.sh | 14 ++++++++++++++ redis.conf | 8 -------- 3 files changed, 16 insertions(+), 12 deletions(-) delete mode 100644 redis.conf diff --git a/Dockerfile b/Dockerfile index 4318bb4..3deef80 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,10 +10,6 @@ ARG REDIS_DOWNLOAD_URL="http://download.redis.io/" ARG REDIS_VERSION="stable" -COPY redis.conf /etc/redis/redis.conf - -COPY entrypoint.sh /usr/bin/entrypoint.sh - RUN addgroup -S -g 1000 redis && adduser -S -G redis -u 999 redis && \ apk add --no-cache su-exec tzdata make curl build-base linux-headers @@ -27,6 +23,8 @@ RUN curl -fL -Lo /tmp/redis-${REDIS_VERSION}.tar.gz ${REDIS_DOWNLOAD_URL}/redis- cp -f *.conf /etc/redis && \ rm -rf /tmp/redis-${REDIS_VERSION}* +COPY entrypoint.sh /usr/bin/entrypoint.sh + VOLUME ["/data"] WORKDIR /data diff --git a/entrypoint.sh b/entrypoint.sh index 1045258..406b0fd 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -2,6 +2,19 @@ set -eu +generate_common_config() { + { + echo "bind 0.0.0.0" + echo protected-mode yes + echo tcp-backlog 511 + echo timeout 0 + echo tcp-keepalive 300 + echo daemonize no + echo supervised no + echo pidfile /var/run/redis.pid + } > /etc/redis/redis.conf +} + set_redis_password() { if [ -z "${REDIS_PASSWORD}" ]; then echo "Redis is running without password which is not recommended" @@ -31,6 +44,7 @@ start_redis() { } main_function() { + generate_common_config set_redis_password redis_mode_setup start_redis diff --git a/redis.conf b/redis.conf deleted file mode 100644 index ddfa540..0000000 --- a/redis.conf +++ /dev/null @@ -1,8 +0,0 @@ -bind 0.0.0.0 -protected-mode yes -tcp-backlog 511 -timeout 0 -tcp-keepalive 300 -daemonize no -supervised no -pidfile /var/run/redis.pid -- 2.26.0