File tree Expand file tree Collapse file tree 2 files changed +27
-6
lines changed Expand file tree Collapse file tree 2 files changed +27
-6
lines changed Original file line number Diff line number Diff line change @@ -11,8 +11,11 @@ RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv C7917B12 && \
11
11
# Add scripts
12
12
ADD run.sh /run.sh
13
13
ADD set_redis_password.sh /set_redis_password.sh
14
- ADD set_redis_mode.sh /set_redis_mode.sh
15
- RUN chmod 755 /*.sh
14
+ RUN chmod +x /*.sh
15
+
16
+ # SET environment variables
17
+ ENV REDIS_MODE **None**
18
+ ENV REDIS_TIMEOUT 0
16
19
17
20
EXPOSE 6379
18
21
CMD ["/run.sh" ]
Original file line number Diff line number Diff line change 1
1
#! /bin/bash
2
- if [ ! -f /.redis_mode_set ]; then
3
- /set_redis_mode.sh
2
+ if [ " ${REDIS_MODE} " == " **None** " ]; then
3
+ unset REDIS_MODE
4
4
fi
5
+
6
+ if [ ! -f /.redis_configured ]; then
7
+ if [ " $REDIS_MODE " == " LRU" ]; then
8
+ echo " => Configuring redis as a LRU cache"
9
+ MAXMEMORY=${REDIS_MAXMEMORY:- " 256mb" }
10
+ touch /etc/redis/redis_default.conf
11
+ echo " maxmemory $MAXMEMORY " >> /etc/redis/redis_default.conf
12
+ echo " maxmemory-policy allkeys-lru" >> /etc/redis/redis_default.conf
13
+ else
14
+ echo " => Unknown $REDIS_MODE mode - ignoring"
15
+ fi
16
+
17
+ echo " => Setting timeout to ${REDIS_TIMEOUT} "
18
+ echo timeout ${REDIS_TIMEOUT} >> /etc/redis/redis_default.conf
19
+
20
+ touch /.redis_configured
21
+ fi
22
+
5
23
if [ ! -f /.redis_password_set ]; then
6
- /set_redis_password.sh
24
+ /set_redis_password.sh
7
25
fi
8
26
9
- exec /usr/bin/redis-server /etc/redis/redis_default.conf
27
+ exec /usr/bin/redis-server /etc/redis/redis_default.conf
You can’t perform that action at this time.
0 commit comments