Skip to content
Permalink
Browse files

feat(reids): using official redis:5-alpine docker image

  • Loading branch information...
duanhongyi
duanhongyi committed Nov 13, 2018
1 parent 5d2308c commit e897f3de7844a5cc1ab4e2a2f54131f906490045
Showing with 9 additions and 35 deletions.
  1. +1 −21 rootfs/Dockerfile
  2. +5 −14 rootfs/bin/boot
  3. +3 −0 rootfs/etc/redis/redis.conf
@@ -1,28 +1,8 @@
FROM quay.io/deis/base:v0.3.6
FROM redis:5-alpine

COPY . /

RUN apt-get update && \
apt-get install -y --no-install-recommends redis-server && \
# cleanup
apt-get clean -y && \
# package up license files if any by appending to existing tar
COPYRIGHT_TAR='/usr/share/copyrights.tar'; \
gunzip -f $COPYRIGHT_TAR.gz; tar -rf $COPYRIGHT_TAR /usr/share/doc/*/copyright; gzip $COPYRIGHT_TAR && \
rm -rf \
/usr/share/doc \
/usr/share/man \
/usr/share/info \
/usr/share/locale \
/var/lib/apt/lists/* \
/var/cache/debconf/* \
/usr/lib/x86_64-linux-gnu/gconv/IBM* \
/usr/lib/x86_64-linux-gnu/gconv/EBC* && \
bash -c "mkdir -p /usr/share/man/man{1..8}" && \
chown -R redis:redis /etc/redis /var/lib/redis /var/log/redis

USER redis
WORKDIR /var/lib/redis

CMD ["/bin/boot"]
EXPOSE 6379
@@ -1,25 +1,16 @@
#!/usr/bin/env bash
#!/usr/bin/env sh

set -eof pipefail

REDIS_CONFIG_FILE=/etc/redis/redis.conf

# Do not daemonize
sed -i "s/daemonize yes/daemonize no/" $REDIS_CONFIG_FILE

# Bind to 0.0.0.0
sed -i "s/bind 127.0.0.1/bind 0.0.0.0/" $REDIS_CONFIG_FILE

# Log to stdout
sed -i "s:logfile /var/log/redis/redis-server.log:logfile \"\":" $REDIS_CONFIG_FILE

# Set password
REDIS_PASSWORD_FILE=/var/run/secrets/deis/redis/creds/password
if [ -e $REDIS_PASSWORD_FILE ]; then
REDIS_PASSWORD="$(cat /var/run/secrets/deis/redis/creds/password)"
if [ ! -z "$REDIS_PASSWORD" ]; then
sed -i "s/# requirepass foobared/requirepass $REDIS_PASSWORD/" $REDIS_CONFIG_FILE
fi
REDIS_PASSWORD="$(cat /var/run/secrets/deis/redis/creds/password)"
if [ ! -z "$REDIS_PASSWORD" ]; then
echo "requirepass $REDIS_PASSWORD" >> REDIS_CONFIG_FILE
fi
fi

exec redis-server $REDIS_CONFIG_FILE
@@ -0,0 +1,3 @@
daemonize no
bind 0.0.0.0
logfile ""

0 comments on commit e897f3d

Please sign in to comment.
You can’t perform that action at this time.