Skip to content

Commit

Permalink
feat(reids): using official redis:5-alpine docker image
Browse files Browse the repository at this point in the history
  • Loading branch information
duanhongyi committed Jan 25, 2019
1 parent 5d2308c commit e897f3d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 35 deletions.
22 changes: 1 addition & 21 deletions rootfs/Dockerfile
Original file line number Diff line number Diff line change
@@ -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
19 changes: 5 additions & 14 deletions rootfs/bin/boot
Original file line number Diff line number Diff line change
@@ -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
3 changes: 3 additions & 0 deletions rootfs/etc/redis/redis.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
daemonize no
bind 0.0.0.0
logfile ""

0 comments on commit e897f3d

Please sign in to comment.