diff --git a/Dockerfile b/Dockerfile index 4318bb486c0cea8fe09e232feb9fcb338837cb01..3deef80396b8284760d9ddf2a315adca0ef7e055 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 10452585d4058cdee7148c2d0c2a213b0548e592..406b0fd980b979efb843aa899dc4ea136ee7a957 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 ddfa5405bc1754322afb018c58f967cddc639cd5..0000000000000000000000000000000000000000 --- 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