forked from redis/docker-library-redis
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
529 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule readies
updated
26 files
+1 −1 | bin/enable-utf8 | |
+21 −0 | bin/getaws | |
+10 −2 | bin/getclang | |
+23 −7 | bin/getepel | |
+54 −37 | bin/getgcc | |
+97 −0 | bin/getgdb | |
+19 −7 | bin/getget | |
+48 −44 | bin/getpy3 | |
+1 −1 | bin/getpyenv | |
+71 −50 | bin/getredis | |
+61 −58 | bin/getrmpytools | |
+5 −6 | bin/getrust | |
+1 −1 | bin/getvalgrind | |
+129 −35 | bin/redis-cmd | |
+7 −4 | bin/sep1 | |
+15 −5 | cetara/diag/gdb.h | |
+3 −2 | mk/cc.defs | |
+6 −0 | mk/cmake.rules | |
+6 −1 | mk/macos.defs | |
+10 −0 | mk/module.docker.rules | |
+4 −2 | mk/rules | |
+9 −2 | paella/files.py | |
+1 −0 | paella/requirements.txt | |
+1 −1 | paella/setup.py | |
+20 −1 | paella/utils.py | |
+4 −2 | shibumi/functions |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
# BUILD redisfab/redis:${REDIS_VER}-${ARCH}-${OSNICK} | ||
|
||
ARG REDIS_VER=unstable | ||
ARG REDIS_MAJOR=unstable | ||
ARG OS=debian:bullseye-slim | ||
ARG OSNICK=bullseye | ||
|
||
# ARCH=x64|arm64v8|arm32v7 | ||
ARG ARCH=x64 | ||
|
||
ARG UID=999 | ||
|
||
ARG JEMALLOC=yes | ||
|
||
#---------------------------------------------------------------------------------------------- | ||
FROM ${OS} as builder | ||
|
||
ARG REDIS_VER | ||
ARG REDIS_MAJOR | ||
ARG OS | ||
ARG OSNICK | ||
ARG ARCH | ||
ARG JEMALLOC | ||
|
||
RUN echo "Building Redis v${REDIS_VER} on ${OSNICK} (${OS}) for ${ARCH}" | ||
RUN uname -a; cat /etc/os-release | ||
|
||
RUN if [ -f /root/.profile ]; then sed -ie 's/mesg n/tty -s \&\& mesg -n/g' /root/.profile; fi | ||
SHELL ["/bin/bash", "-l", "-c"] | ||
|
||
WORKDIR /build | ||
|
||
ADD deps/ /build/deps/ | ||
ADD ${REDIS_MAJOR}/system-setup.py /build/ | ||
ADD ${REDIS_MAJOR}/*.patch /build/ | ||
ADD ${REDIS_MAJOR}/build-fix-* /build/ | ||
|
||
# ENV REDIS_DEPENDS "ca-certificates dirmngr gnupg wget gcc libc6-dev make" | ||
|
||
# WORKAROUND for glibc 2.33 and old Docker | ||
# See https://github.com/actions/virtual-environments/issues/2658 | ||
# Thanks to https://github.com/lxqt/lxqt-panel/pull/1562 | ||
#RUN patched_glibc=glibc-linux4-2.33-4-x86_64.pkg.tar.zst && \ | ||
# curl -LO "https://repo.archlinuxcn.org/x86_64/$patched_glibc" && \ | ||
# bsdtar -C / -xvf "$patched_glibc" | ||
|
||
RUN /build/deps/readies/bin/getbash | ||
RUN /build/deps/readies/bin/getupdates | ||
RUN /build/deps/readies/bin/getpy3 | ||
RUN /build/system-setup.py | ||
|
||
RUN gcc --version | ||
|
||
ENV GOSU_VERSION 1.16 | ||
RUN set -ex ;\ | ||
/build/deps/readies/bin/getgosu ;\ | ||
gosu --version; \ | ||
gosu nobody true | ||
|
||
ENV REDIS_VERSION ${REDIS_VER} | ||
ENV REDIS_DOWNLOAD_URL https://github.com/redis/redis/archive/${REDIS_VER}.tar.gz | ||
# ENV REDIS_DOWNLOAD_URL http://download.redis.io/releases/redis-${REDIS_VER}.tar.gz | ||
ENV REDIS_DOWNLOAD_SHA dc2bdcf81c620e9f09cfd12e85d3bc631c897b2db7a55218fd8a65eaa37f86dd | ||
ENV JEMALLOC ${JEMALLOC} | ||
|
||
# for redis-sentinel see: http://redis.io/topics/sentinel | ||
RUN set -ex; \ | ||
wget -q -O redis.tar.gz "$REDIS_DOWNLOAD_URL"; \ | ||
mkdir -p /usr/src/redis; \ | ||
tar -xzf redis.tar.gz -C /usr/src/redis --strip-components=1 | ||
|
||
RUN ./build-fix-1 | ||
RUN ./build-fix-2 | ||
|
||
# note: ARCH may break build if non-empty | ||
RUN set -ex; \ | ||
export BUILD_TLS=yes; \ | ||
/build/deps/readies/bin/runn ARCH= make REDIS_CFLAGS=-DUSE_JEMALLOC=${JEMALLOC} V=1 -C /usr/src/redis all; \ | ||
/build/deps/readies/bin/runn make -C /usr/src/redis install | ||
|
||
#---------------------------------------------------------------------------------------------- | ||
FROM ${OS} | ||
|
||
ARG REDIS_VER | ||
ARG REDIS_MAJOR | ||
ARG ARCH | ||
ARG OSNICK | ||
ARG UID | ||
|
||
RUN echo "Building redisfab/redis-${ARCH}-${OSNICK}:${REDIS_VER} UID=${UID}" | ||
|
||
COPY platforms/setup.${OSNICK} /usr/local/bin/docker-setup | ||
RUN chmod +x /usr/local/bin/docker-setup | ||
RUN /usr/local/bin/docker-setup | ||
RUN rm /usr/local/bin/docker-setup | ||
|
||
# Add our user and group first to make sure their IDs get assigned consistently, | ||
# regardless of whatever dependencies get added | ||
RUN set -xe; \ | ||
if [ -f /sbin/groupadd ] || [ -f /usr/sbin/groupadd ]; then \ | ||
groupadd -r -g ${UID} redis && useradd -r -g redis -u ${UID} redis ;\ | ||
else \ | ||
addgroup --gid ${UID} redis && adduser --system --uid ${UID} redis ;\ | ||
fi | ||
|
||
COPY --from=builder /usr/local/ /usr/local/ | ||
|
||
RUN mkdir /data && chown redis:redis /data | ||
VOLUME /data | ||
WORKDIR /data | ||
|
||
COPY ${REDIS_MAJOR}/docker-entrypoint.sh /usr/local/bin/ | ||
RUN chmod 755 /usr/local/bin/docker-entrypoint.sh | ||
|
||
ENTRYPOINT ["docker-entrypoint.sh"] | ||
EXPOSE 6379 | ||
CMD ["redis-server"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
FROM debian:bullseye-slim | ||
|
||
# add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added | ||
RUN groupadd -r -g 999 redis && useradd -r -g redis -u 999 redis | ||
|
||
# grab gosu for easy step-down from root | ||
# https://github.com/tianon/gosu/releases | ||
ENV GOSU_VERSION 1.16 | ||
RUN set -eux; \ | ||
savedAptMark="$(apt-mark showmanual)"; \ | ||
apt-get update; \ | ||
apt-get install -y --no-install-recommends ca-certificates dirmngr gnupg wget; \ | ||
rm -rf /var/lib/apt/lists/*; \ | ||
dpkgArch="$(dpkg --print-architecture | awk -F- '{ print $NF }')"; \ | ||
wget -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$dpkgArch"; \ | ||
wget -O /usr/local/bin/gosu.asc "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$dpkgArch.asc"; \ | ||
export GNUPGHOME="$(mktemp -d)"; \ | ||
gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4; \ | ||
gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu; \ | ||
gpgconf --kill all; \ | ||
rm -rf "$GNUPGHOME" /usr/local/bin/gosu.asc; \ | ||
apt-mark auto '.*' > /dev/null; \ | ||
[ -z "$savedAptMark" ] || apt-mark manual $savedAptMark > /dev/null; \ | ||
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ | ||
chmod +x /usr/local/bin/gosu; \ | ||
gosu --version; \ | ||
gosu nobody true | ||
|
||
ENV REDIS_VERSION 7.2-rc1 | ||
ENV REDIS_DOWNLOAD_URL https://github.com/redis/redis/archive/7.2-rc1.tar.gz | ||
ENV REDIS_DOWNLOAD_SHA d94d95c448eeb3dca8b4fd4801f9d2f8bdae0f5f84b2d9f5cfbd48cd6d8d5b43 | ||
|
||
RUN set -eux; \ | ||
\ | ||
savedAptMark="$(apt-mark showmanual)"; \ | ||
apt-get update; \ | ||
apt-get install -y --no-install-recommends \ | ||
ca-certificates \ | ||
wget \ | ||
\ | ||
dpkg-dev \ | ||
gcc \ | ||
libc6-dev \ | ||
libssl-dev \ | ||
make \ | ||
; \ | ||
rm -rf /var/lib/apt/lists/*; \ | ||
\ | ||
wget -O redis.tar.gz "$REDIS_DOWNLOAD_URL"; \ | ||
echo "$REDIS_DOWNLOAD_SHA *redis.tar.gz" | sha256sum -c -; \ | ||
mkdir -p /usr/src/redis; \ | ||
tar -xzf redis.tar.gz -C /usr/src/redis --strip-components=1; \ | ||
rm redis.tar.gz; \ | ||
\ | ||
# disable Redis protected mode [1] as it is unnecessary in context of Docker | ||
# (ports are not automatically exposed when running inside Docker, but rather explicitly by specifying -p / -P) | ||
# [1]: https://github.com/redis/redis/commit/edd4d555df57dc84265fdfb4ef59a4678832f6da | ||
grep -E '^ *createBoolConfig[(]"protected-mode",.*, *1 *,.*[)],$' /usr/src/redis/src/config.c; \ | ||
sed -ri 's!^( *createBoolConfig[(]"protected-mode",.*, *)1( *,.*[)],)$!\10\2!' /usr/src/redis/src/config.c; \ | ||
grep -E '^ *createBoolConfig[(]"protected-mode",.*, *0 *,.*[)],$' /usr/src/redis/src/config.c; \ | ||
# 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" | ||
# see also https://github.com/docker-library/redis/issues/4#issuecomment-50780840 | ||
# (more exactly, this makes sure the default behavior of "save on SIGTERM" stays functional by default) | ||
\ | ||
# https://github.com/jemalloc/jemalloc/issues/467 -- we need to patch the "./configure" for the bundled jemalloc to match how Debian compiles, for compatibility | ||
# (also, we do cross-builds, so we need to embed the appropriate "--build=xxx" values to that "./configure" invocation) | ||
gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ | ||
extraJemallocConfigureFlags="--build=$gnuArch"; \ | ||
# https://salsa.debian.org/debian/jemalloc/-/blob/c0a88c37a551be7d12e4863435365c9a6a51525f/debian/rules#L8-23 | ||
dpkgArch="$(dpkg --print-architecture)"; \ | ||
case "${dpkgArch##*-}" in \ | ||
amd64 | i386 | x32) extraJemallocConfigureFlags="$extraJemallocConfigureFlags --with-lg-page=12" ;; \ | ||
*) extraJemallocConfigureFlags="$extraJemallocConfigureFlags --with-lg-page=16" ;; \ | ||
esac; \ | ||
extraJemallocConfigureFlags="$extraJemallocConfigureFlags --with-lg-hugepage=21"; \ | ||
grep -F 'cd jemalloc && ./configure ' /usr/src/redis/deps/Makefile; \ | ||
sed -ri 's!cd jemalloc && ./configure !&'"$extraJemallocConfigureFlags"' !' /usr/src/redis/deps/Makefile; \ | ||
grep -F "cd jemalloc && ./configure $extraJemallocConfigureFlags " /usr/src/redis/deps/Makefile; \ | ||
\ | ||
export BUILD_TLS=yes; \ | ||
make -C /usr/src/redis -j "$(nproc)" all; \ | ||
make -C /usr/src/redis install; \ | ||
\ | ||
# TODO https://github.com/redis/redis/pull/3494 (deduplicate "redis-server" copies) | ||
serverMd5="$(md5sum /usr/local/bin/redis-server | cut -d' ' -f1)"; export serverMd5; \ | ||
find /usr/local/bin/redis* -maxdepth 0 \ | ||
-type f -not -name redis-server \ | ||
-exec sh -eux -c ' \ | ||
md5="$(md5sum "$1" | cut -d" " -f1)"; \ | ||
test "$md5" = "$serverMd5"; \ | ||
' -- '{}' ';' \ | ||
-exec ln -svfT 'redis-server' '{}' ';' \ | ||
; \ | ||
\ | ||
rm -r /usr/src/redis; \ | ||
\ | ||
apt-mark auto '.*' > /dev/null; \ | ||
[ -z "$savedAptMark" ] || apt-mark manual $savedAptMark > /dev/null; \ | ||
find /usr/local -type f -executable -exec ldd '{}' ';' \ | ||
| awk '/=>/ { print $(NF-1) }' \ | ||
| sort -u \ | ||
| xargs -r dpkg-query --search \ | ||
| cut -d: -f1 \ | ||
| sort -u \ | ||
| xargs -r apt-mark manual \ | ||
; \ | ||
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ | ||
\ | ||
redis-cli --version; \ | ||
redis-server --version | ||
|
||
RUN mkdir /data && chown redis:redis /data | ||
VOLUME /data | ||
WORKDIR /data | ||
|
||
COPY docker-entrypoint.sh /usr/local/bin/ | ||
ENTRYPOINT ["docker-entrypoint.sh"] | ||
|
||
EXPOSE 6379 | ||
CMD ["redis-server"] |
Oops, something went wrong.