redis 6.2.5

This commit is contained in:
yangyu 2021-08-19 14:15:23 +08:00
parent bdf5683efd
commit 23cd5cd2ac
5 changed files with 67 additions and 2 deletions

53
redis/6.2.5/Dockerfile Normal file
View File

@ -0,0 +1,53 @@
FROM centos:7
MAINTAINER Yang <yangyufans@qq.com>
ENV REDIS_VERSION=6.2.5
RUN yum install -y wget gcc make which zlib-devel openssl-devel
RUN cd / && wget https://cache.ruby-lang.org/pub/ruby/2.6/ruby-2.6.0.tar.gz \
&& tar -zvxf ruby-2.6.0.tar.gz \
&& rm -rf ruby-2.6.0.tar.gz \
&& cd /ruby-2.6.0 \
&& ./configure \
&& make && make install
RUN cd /ruby-2.6.0/ext/zlib \
&& ruby extconf.rb \
&& sed -i 's/$(top_srcdir)/..\/..\//' Makefile \
&& make && make install
RUN cd /ruby-2.6.0/ext/openssl \
&& ruby extconf.rb --with-openssl-include=/usr/local/openssl/include/ --with-openssl-lib=/usr/local/openssl/lib \
&& sed -i 's/$(top_srcdir)/..\/..\//' Makefile \
&& make && make install
RUN gem install redis
RUN cd / && wget http://download.redis.io/releases/redis-$REDIS_VERSION.tar.gz \
&& tar -zxvf redis-$REDIS_VERSION.tar.gz \
&& rm -rf redis-$REDIS_VERSION.tar.gz \
&& cd /redis-$REDIS_VERSION \
&& make MALLOC=libc \
&& make install \
&& cp /redis-$REDIS_VERSION/redis.conf /usr/local/bin/ \
&& cd /
RUN mkdir /redis /redis/conf /redis/logs /redis/data
RUN sed -i 's/logfile ""/logfile "\/redis\/logs\/redis.log"/' /usr/local/bin/redis.conf && \
sed -i 's/bind 127.0.0.1/#bind 127.0.0.1/' /usr/local/bin/redis.conf && \
sed -i 's/dir .\//dir \/redis\/data\//' /usr/local/bin/redis.conf
RUN echo "ZONE=Asia/Shanghai" > /etc/sysconfig/clock && \
rm -rf /etc/localtime && \
ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
COPY start.sh /
RUN chmod 777 /start.sh
EXPOSE 6379 16379
ENTRYPOINT ["/start.sh"]

12
redis/6.2.5/start.sh Normal file
View File

@ -0,0 +1,12 @@
#!/bin/bash
if [ ! -e /redis/conf/redis.conf ]; then
cp /usr/local/bin/redis.conf /redis/conf
if [ -n "$PASSWORD" ]; then
echo "requirepass $PASSWORD" >> /redis/conf/redis.conf
fi
fi
redis-server /redis/conf/redis.conf

View File

@ -4,13 +4,13 @@
镜像构建源码请[参考](http://git.yangyufans.com/pub/docker/tree/master/redis)
```bash
docker build -t ccr.ccs.tencentyun.com/yy-dk/dynamic:0.0.1 .
docker build -t ccr.ccs.tencentyun.com/yy-dk/redis:4.0.10 .
```
## 从远程仓库下拉
```bash
docker pull ccr.ccs.tencentyun.com/yy-dk/dynamic:0.0.1
docker pull ccr.ccs.tencentyun.com/yy-dk/redis:4.0.10
```
## 创建容器