Skip to content

Commit 9c13d36

Browse files
authored
Merge pull request #147 from infosiftr/5.0-rc3
Add 5.0-rc3
2 parents fe9b884 + 403f00a commit 9c13d36

File tree

8 files changed

+313
-5
lines changed

8 files changed

+313
-5
lines changed

.travis.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ language: bash
22
services: docker
33

44
env:
5+
- VERSION=5.0-rc VARIANT=
6+
- VERSION=5.0-rc VARIANT=32bit
7+
- VERSION=5.0-rc VARIANT=alpine
58
- VERSION=4.0 VARIANT=
69
- VERSION=4.0 VARIANT=32bit
710
- VERSION=4.0 VARIANT=alpine

5.0-rc/32bit/Dockerfile

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
FROM debian:stretch-slim
2+
3+
# add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added
4+
RUN groupadd -r redis && useradd -r -g redis redis
5+
6+
# grab gosu for easy step-down from root
7+
# https://github.com/tianon/gosu/releases
8+
ENV GOSU_VERSION 1.10
9+
RUN set -ex; \
10+
\
11+
fetchDeps=" \
12+
ca-certificates \
13+
dirmngr \
14+
gnupg \
15+
wget \
16+
"; \
17+
apt-get update; \
18+
apt-get install -y --no-install-recommends $fetchDeps; \
19+
rm -rf /var/lib/apt/lists/*; \
20+
\
21+
dpkgArch="$(dpkg --print-architecture | awk -F- '{ print $NF }')"; \
22+
wget -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$dpkgArch"; \
23+
wget -O /usr/local/bin/gosu.asc "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$dpkgArch.asc"; \
24+
export GNUPGHOME="$(mktemp -d)"; \
25+
gpg --keyserver ha.pool.sks-keyservers.net --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4; \
26+
gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu; \
27+
gpgconf --kill all; \
28+
rm -r "$GNUPGHOME" /usr/local/bin/gosu.asc; \
29+
chmod +x /usr/local/bin/gosu; \
30+
gosu nobody true; \
31+
\
32+
apt-get purge -y --auto-remove $fetchDeps
33+
34+
ENV REDIS_VERSION 5.0-rc3
35+
ENV REDIS_DOWNLOAD_URL https://github.com/antirez/redis/archive/5.0-rc3.tar.gz
36+
ENV REDIS_DOWNLOAD_SHA 4bb2eeef3695d66d8b64767825acfeeb157d64536233eac7eae71b236fd6554f
37+
38+
RUN apt-get update && apt-get install -y --no-install-recommends \
39+
libc6-i386 \
40+
&& rm -rf /var/lib/apt/lists/*
41+
42+
# for redis-sentinel see: http://redis.io/topics/sentinel
43+
RUN set -ex; \
44+
\
45+
buildDeps=' \
46+
ca-certificates \
47+
wget \
48+
\
49+
gcc \
50+
gcc-multilib \
51+
libc6-dev-i386 \
52+
make \
53+
'; \
54+
apt-get update; \
55+
apt-get install -y $buildDeps --no-install-recommends; \
56+
rm -rf /var/lib/apt/lists/*; \
57+
\
58+
wget -O redis.tar.gz "$REDIS_DOWNLOAD_URL"; \
59+
echo "$REDIS_DOWNLOAD_SHA *redis.tar.gz" | sha256sum -c -; \
60+
mkdir -p /usr/src/redis; \
61+
tar -xzf redis.tar.gz -C /usr/src/redis --strip-components=1; \
62+
rm redis.tar.gz; \
63+
\
64+
# disable Redis protected mode [1] as it is unnecessary in context of Docker
65+
# (ports are not automatically exposed when running inside Docker, but rather explicitly by specifying -p / -P)
66+
# [1]: https://github.com/antirez/redis/commit/edd4d555df57dc84265fdfb4ef59a4678832f6da
67+
grep -q '^#define CONFIG_DEFAULT_PROTECTED_MODE 1$' /usr/src/redis/src/server.h; \
68+
sed -ri 's!^(#define CONFIG_DEFAULT_PROTECTED_MODE) 1$!\1 0!' /usr/src/redis/src/server.h; \
69+
grep -q '^#define CONFIG_DEFAULT_PROTECTED_MODE 0$' /usr/src/redis/src/server.h; \
70+
# for future reference, we modify this directly in the source instead of just supplying a default configuration flag because apparently "if you specify any argument to redis-server, [it assumes] you are going to specify everything"
71+
# see also https://github.com/docker-library/redis/issues/4#issuecomment-50780840
72+
# (more exactly, this makes sure the default behavior of "save on SIGTERM" stays functional by default)
73+
\
74+
make -C /usr/src/redis -j "$(nproc)" 32bit; \
75+
make -C /usr/src/redis install; \
76+
\
77+
rm -r /usr/src/redis; \
78+
\
79+
apt-get purge -y --auto-remove $buildDeps
80+
81+
RUN mkdir /data && chown redis:redis /data
82+
VOLUME /data
83+
WORKDIR /data
84+
85+
COPY docker-entrypoint.sh /usr/local/bin/
86+
ENTRYPOINT ["docker-entrypoint.sh"]
87+
88+
EXPOSE 6379
89+
CMD ["redis-server"]

5.0-rc/32bit/docker-entrypoint.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/sh
2+
set -e
3+
4+
# first arg is `-f` or `--some-option`
5+
# or first arg is `something.conf`
6+
if [ "${1#-}" != "$1" ] || [ "${1%.conf}" != "$1" ]; then
7+
set -- redis-server "$@"
8+
fi
9+
10+
# allow the container to be started with `--user`
11+
if [ "$1" = 'redis-server' -a "$(id -u)" = '0' ]; then
12+
chown -R redis .
13+
exec gosu redis "$0" "$@"
14+
fi
15+
16+
exec "$@"

5.0-rc/Dockerfile

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
FROM debian:stretch-slim
2+
3+
# add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added
4+
RUN groupadd -r redis && useradd -r -g redis redis
5+
6+
# grab gosu for easy step-down from root
7+
# https://github.com/tianon/gosu/releases
8+
ENV GOSU_VERSION 1.10
9+
RUN set -ex; \
10+
\
11+
fetchDeps=" \
12+
ca-certificates \
13+
dirmngr \
14+
gnupg \
15+
wget \
16+
"; \
17+
apt-get update; \
18+
apt-get install -y --no-install-recommends $fetchDeps; \
19+
rm -rf /var/lib/apt/lists/*; \
20+
\
21+
dpkgArch="$(dpkg --print-architecture | awk -F- '{ print $NF }')"; \
22+
wget -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$dpkgArch"; \
23+
wget -O /usr/local/bin/gosu.asc "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$dpkgArch.asc"; \
24+
export GNUPGHOME="$(mktemp -d)"; \
25+
gpg --keyserver ha.pool.sks-keyservers.net --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4; \
26+
gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu; \
27+
gpgconf --kill all; \
28+
rm -r "$GNUPGHOME" /usr/local/bin/gosu.asc; \
29+
chmod +x /usr/local/bin/gosu; \
30+
gosu nobody true; \
31+
\
32+
apt-get purge -y --auto-remove $fetchDeps
33+
34+
ENV REDIS_VERSION 5.0-rc3
35+
ENV REDIS_DOWNLOAD_URL https://github.com/antirez/redis/archive/5.0-rc3.tar.gz
36+
ENV REDIS_DOWNLOAD_SHA 4bb2eeef3695d66d8b64767825acfeeb157d64536233eac7eae71b236fd6554f
37+
38+
# for redis-sentinel see: http://redis.io/topics/sentinel
39+
RUN set -ex; \
40+
\
41+
buildDeps=' \
42+
ca-certificates \
43+
wget \
44+
\
45+
gcc \
46+
libc6-dev \
47+
make \
48+
'; \
49+
apt-get update; \
50+
apt-get install -y $buildDeps --no-install-recommends; \
51+
rm -rf /var/lib/apt/lists/*; \
52+
\
53+
wget -O redis.tar.gz "$REDIS_DOWNLOAD_URL"; \
54+
echo "$REDIS_DOWNLOAD_SHA *redis.tar.gz" | sha256sum -c -; \
55+
mkdir -p /usr/src/redis; \
56+
tar -xzf redis.tar.gz -C /usr/src/redis --strip-components=1; \
57+
rm redis.tar.gz; \
58+
\
59+
# disable Redis protected mode [1] as it is unnecessary in context of Docker
60+
# (ports are not automatically exposed when running inside Docker, but rather explicitly by specifying -p / -P)
61+
# [1]: https://github.com/antirez/redis/commit/edd4d555df57dc84265fdfb4ef59a4678832f6da
62+
grep -q '^#define CONFIG_DEFAULT_PROTECTED_MODE 1$' /usr/src/redis/src/server.h; \
63+
sed -ri 's!^(#define CONFIG_DEFAULT_PROTECTED_MODE) 1$!\1 0!' /usr/src/redis/src/server.h; \
64+
grep -q '^#define CONFIG_DEFAULT_PROTECTED_MODE 0$' /usr/src/redis/src/server.h; \
65+
# for future reference, we modify this directly in the source instead of just supplying a default configuration flag because apparently "if you specify any argument to redis-server, [it assumes] you are going to specify everything"
66+
# see also https://github.com/docker-library/redis/issues/4#issuecomment-50780840
67+
# (more exactly, this makes sure the default behavior of "save on SIGTERM" stays functional by default)
68+
\
69+
make -C /usr/src/redis -j "$(nproc)"; \
70+
make -C /usr/src/redis install; \
71+
\
72+
rm -r /usr/src/redis; \
73+
\
74+
apt-get purge -y --auto-remove $buildDeps
75+
76+
RUN mkdir /data && chown redis:redis /data
77+
VOLUME /data
78+
WORKDIR /data
79+
80+
COPY docker-entrypoint.sh /usr/local/bin/
81+
ENTRYPOINT ["docker-entrypoint.sh"]
82+
83+
EXPOSE 6379
84+
CMD ["redis-server"]

5.0-rc/alpine/Dockerfile

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
FROM alpine:3.7
2+
3+
# add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added
4+
RUN addgroup -S redis && adduser -S -G redis redis
5+
6+
# grab su-exec for easy step-down from root
7+
RUN apk add --no-cache 'su-exec>=0.2'
8+
9+
ENV REDIS_VERSION 5.0-rc3
10+
ENV REDIS_DOWNLOAD_URL https://github.com/antirez/redis/archive/5.0-rc3.tar.gz
11+
ENV REDIS_DOWNLOAD_SHA 4bb2eeef3695d66d8b64767825acfeeb157d64536233eac7eae71b236fd6554f
12+
13+
# for redis-sentinel see: http://redis.io/topics/sentinel
14+
RUN set -ex; \
15+
\
16+
apk add --no-cache --virtual .build-deps \
17+
ca-certificates \
18+
coreutils \
19+
gcc \
20+
jemalloc-dev \
21+
linux-headers \
22+
make \
23+
musl-dev \
24+
wget \
25+
; \
26+
\
27+
wget -O redis.tar.gz "$REDIS_DOWNLOAD_URL"; \
28+
echo "$REDIS_DOWNLOAD_SHA *redis.tar.gz" | sha256sum -c -; \
29+
mkdir -p /usr/src/redis; \
30+
tar -xzf redis.tar.gz -C /usr/src/redis --strip-components=1; \
31+
rm redis.tar.gz; \
32+
\
33+
# disable Redis protected mode [1] as it is unnecessary in context of Docker
34+
# (ports are not automatically exposed when running inside Docker, but rather explicitly by specifying -p / -P)
35+
# [1]: https://github.com/antirez/redis/commit/edd4d555df57dc84265fdfb4ef59a4678832f6da
36+
grep -q '^#define CONFIG_DEFAULT_PROTECTED_MODE 1$' /usr/src/redis/src/server.h; \
37+
sed -ri 's!^(#define CONFIG_DEFAULT_PROTECTED_MODE) 1$!\1 0!' /usr/src/redis/src/server.h; \
38+
grep -q '^#define CONFIG_DEFAULT_PROTECTED_MODE 0$' /usr/src/redis/src/server.h; \
39+
# for future reference, we modify this directly in the source instead of just supplying a default configuration flag because apparently "if you specify any argument to redis-server, [it assumes] you are going to specify everything"
40+
# see also https://github.com/docker-library/redis/issues/4#issuecomment-50780840
41+
# (more exactly, this makes sure the default behavior of "save on SIGTERM" stays functional by default)
42+
\
43+
make -C /usr/src/redis -j "$(nproc)"; \
44+
make -C /usr/src/redis install; \
45+
\
46+
rm -r /usr/src/redis; \
47+
\
48+
runDeps="$( \
49+
scanelf --needed --nobanner --format '%n#p' --recursive /usr/local \
50+
| tr ',' '\n' \
51+
| sort -u \
52+
| awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \
53+
)"; \
54+
apk add --virtual .redis-rundeps $runDeps; \
55+
apk del .build-deps; \
56+
\
57+
redis-server --version
58+
59+
RUN mkdir /data && chown redis:redis /data
60+
VOLUME /data
61+
WORKDIR /data
62+
63+
COPY docker-entrypoint.sh /usr/local/bin/
64+
ENTRYPOINT ["docker-entrypoint.sh"]
65+
66+
EXPOSE 6379
67+
CMD ["redis-server"]

5.0-rc/alpine/docker-entrypoint.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/sh
2+
set -e
3+
4+
# first arg is `-f` or `--some-option`
5+
# or first arg is `something.conf`
6+
if [ "${1#-}" != "$1" ] || [ "${1%.conf}" != "$1" ]; then
7+
set -- redis-server "$@"
8+
fi
9+
10+
# allow the container to be started with `--user`
11+
if [ "$1" = 'redis-server' -a "$(id -u)" = '0' ]; then
12+
chown -R redis .
13+
exec su-exec redis "$0" "$@"
14+
fi
15+
16+
exec "$@"

5.0-rc/docker-entrypoint.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/sh
2+
set -e
3+
4+
# first arg is `-f` or `--some-option`
5+
# or first arg is `something.conf`
6+
if [ "${1#-}" != "$1" ] || [ "${1%.conf}" != "$1" ]; then
7+
set -- redis-server "$@"
8+
fi
9+
10+
# allow the container to be started with `--user`
11+
if [ "$1" = 'redis-server' -a "$(id -u)" = '0' ]; then
12+
chown -R redis .
13+
exec gosu redis "$0" "$@"
14+
fi
15+
16+
exec "$@"

update.sh

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,35 @@ curl -fsSL "$packagesUrl" > "$packages"
1515

1616
travisEnv=
1717
for version in "${versions[@]}"; do
18+
rcVersion="${version%-rc}"
19+
1820
line="$(awk '/^hash redis-'"$version"\.'/' "$packages" | sort -rV | head -1)"
19-
fullVersion="$(echo "$line" | cut -d' ' -f2 | sed -r 's/^redis-|\.tar\..*$//g')"
20-
downloadUrl="$(echo "$line" | cut -d' ' -f5 | sed 's/[\/&]/\\&/g')"
21-
shaHash="$(echo "$line" | cut -d' ' -f4)"
22-
shaType="$(echo "$line" | cut -d' ' -f3)"
21+
if [ -n "$line" ]; then
22+
fullVersion="$(echo "$line" | cut -d' ' -f2 | sed -r 's/^redis-|\.tar\..*$//g')"
23+
downloadUrl="$(echo "$line" | cut -d' ' -f5)"
24+
shaHash="$(echo "$line" | cut -d' ' -f4)"
25+
shaType="$(echo "$line" | cut -d' ' -f3)"
26+
elif [ "$version" != "$rcVersion" ] && fullVersion="$(
27+
git ls-remote --tags https://github.com/antirez/redis.git "refs/tags/$rcVersion*" \
28+
| cut -d/ -f3 \
29+
| cut -d^ -f1 \
30+
| sort -urV \
31+
| head -1
32+
)" && [ -n "$fullVersion" ]; then
33+
downloadUrl="https://github.com/antirez/redis/archive/$fullVersion.tar.gz"
34+
shaType='sha256'
35+
shaHash="$(curl -fsSL "$downloadUrl" | "${shaType}sum" | cut -d' ' -f1)"
36+
else
37+
echo >&2 "error: full version for $version cannot be determined"
38+
exit 1
39+
fi
2340
[ "$shaType" = 'sha256' ] || [ "$shaType" = 'sha1' ]
2441

2542
(
2643
set -x
2744
sed -ri \
2845
-e 's/^(ENV REDIS_VERSION) .*/\1 '"$fullVersion"'/' \
29-
-e 's/^(ENV REDIS_DOWNLOAD_URL) .*/\1 '"$downloadUrl"'/' \
46+
-e 's!^(ENV REDIS_DOWNLOAD_URL) .*!\1 '"$downloadUrl"'!' \
3047
-e 's/^(ENV REDIS_DOWNLOAD_SHA) .*/\1 '"$shaHash"'/' \
3148
-e 's!sha[0-9]+sum!'"$shaType"'sum!g' \
3249
"$version"/{,*/}Dockerfile

0 commit comments

Comments
 (0)