Skip to content

Commit 2ead36f

Browse files
committed
updated redis version (7.0.0)
1 parent b4092ea commit 2ead36f

File tree

1 file changed

+184
-164
lines changed

1 file changed

+184
-164
lines changed

Dockerfile

Lines changed: 184 additions & 164 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# global args
22
ARG __BUILD_DIR__="/build"
33
ARG __DATA_DIR__="/data"
4-
ARG REDIS_VERSION="6.2.6"
4+
ARG REDIS_VERSION="7.0.0"
55

66

77

@@ -15,8 +15,8 @@ ARG __USER__="root"
1515
ARG __SOURCE_DIR__="${__WORK_DIR__}/src"
1616

1717
ENV \
18-
LANG="C.UTF-8" \
19-
LC_ALL="C.UTF-8"
18+
LANG="C.UTF-8" \
19+
LC_ALL="C.UTF-8"
2020

2121
USER "${__USER__}"
2222

@@ -28,165 +28,185 @@ SHELL ["/bin/bash", "-o", "pipefail", "-c"]
2828

2929
RUN \
3030
# build env
31-
echo '--> setting build env' && \
32-
set +h && \
33-
export __NPROC__="$(getconf _NPROCESSORS_ONLN || echo 1)" && \
34-
export DCACHE_LINESIZE="$(getconf LEVEL1_DCACHE_LINESIZE || echo 64)" && \
35-
export MAKEFLAGS="--silent --no-print-directory --jobs ${__NPROC__}" && \
36-
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig && \
31+
echo '--> setting build env' && \
32+
set +h && \
33+
export __NPROC__="$(getconf _NPROCESSORS_ONLN || echo 1)" && \
34+
export DCACHE_LINESIZE="$(getconf LEVEL1_DCACHE_LINESIZE || echo 64)" && \
35+
export MAKEFLAGS="--silent --no-print-directory --jobs ${__NPROC__}" && \
36+
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig && \
3737
# build structure
38-
echo '--> creating build structure' && \
39-
for folder in 'bin'; do \
40-
install --directory --owner="${__USER__}" --group="${__USER__}" --mode=0755 "${__BUILD_DIR__}/usr/${folder}"; \
41-
done && \
42-
for folder in '/tmp' "${__DATA_DIR__}"; do \
43-
install --directory --owner="${__USER__}" --group="${__USER__}" --mode=1777 "${__BUILD_DIR__}${folder}"; \
44-
done && \
38+
echo '--> creating build structure' && \
39+
for folder in 'bin'; do \
40+
install --directory --owner="${__USER__}" --group="${__USER__}" --mode=0755 "${__BUILD_DIR__}/usr/${folder}"; \
41+
done && \
42+
for folder in '/tmp' "${__DATA_DIR__}"; do \
43+
install --directory --owner="${__USER__}" --group="${__USER__}" --mode=1777 "${__BUILD_DIR__}${folder}"; \
44+
done && \
4545
# dependencies
46-
echo '--> instaling dependencies' && \
47-
dnf --assumeyes --quiet --setopt=install_weak_deps='no' install \
48-
binutils \
49-
ca-certificates \
50-
curl \
51-
diffutils \
52-
file \
53-
findutils \
54-
gcc \
55-
gettext \
56-
gzip \
57-
jq \
58-
make \
59-
perl-autodie \
60-
perl-interpreter \
61-
perl-open \
62-
rsync \
63-
tar \
64-
xz \
65-
> /dev/null && \
46+
echo '--> instaling dependencies' && \
47+
dnf --assumeyes --quiet --setopt=install_weak_deps='no' install \
48+
binutils \
49+
ca-certificates \
50+
curl \
51+
diffutils \
52+
file \
53+
findutils \
54+
gcc \
55+
gettext \
56+
gzip \
57+
jq \
58+
make \
59+
perl-autodie \
60+
perl-base \
61+
perl-interpreter \
62+
perl-lib \
63+
perl-open \
64+
perl-File-Compare \
65+
perl-File-Copy \
66+
perl-FindBin \
67+
perl-IPC-Cmd \
68+
rsync \
69+
tar \
70+
which \
71+
xz \
72+
> /dev/null && \
6673
# kernel headers
67-
echo '--> installing kernel headers' && \
68-
KERNEL_VERSION="$(curl --silent --location --retry 3 'https://www.kernel.org/releases.json' | jq -r '.latest_stable.version')" && \
69-
install --directory "${__SOURCE_DIR__}/kernel" && \
70-
curl --silent --location --retry 3 "https://cdn.kernel.org/pub/linux/kernel/v${KERNEL_VERSION%%.*}.x/linux-${KERNEL_VERSION}.tar.xz" \
71-
| tar xJ --no-same-owner --strip-components=1 -C "${__SOURCE_DIR__}/kernel" $(echo linux-*/{Makefile,arch,include,scripts,tools,usr}) && \
72-
cd "${__SOURCE_DIR__}/kernel" && \
73-
make INSTALL_HDR_PATH="/usr/local" headers_install > /dev/null && \
74-
cd ~- && \
75-
rm -rf "${__SOURCE_DIR__}/kernel" && \
74+
echo '--> installing kernel headers' && \
75+
KERNEL_VERSION="$(curl --silent --location --retry 3 'https://www.kernel.org/releases.json' | jq -r '.latest_stable.version')" && \
76+
install --directory "${__SOURCE_DIR__}/kernel" && \
77+
curl --silent --location --retry 3 "https://cdn.kernel.org/pub/linux/kernel/v${KERNEL_VERSION%%.*}.x/linux-${KERNEL_VERSION}.tar.xz" \
78+
| tar xJ --no-same-owner --strip-components=1 -C "${__SOURCE_DIR__}/kernel" $(echo linux-*/{Makefile,arch,include,scripts,tools,usr}) && \
79+
cd "${__SOURCE_DIR__}/kernel" && \
80+
make INSTALL_HDR_PATH="/usr/local" headers_install > /dev/null && \
81+
# The kernel headers that exported to user space are not covered by the GPLv2 license.
82+
# This is documented in the "Linux kernel licensing rules":
83+
# https://www.kernel.org/doc/html/latest/process/license-rules.html
84+
cd ~- && \
85+
rm -rf "${__SOURCE_DIR__}/kernel" && \
7686
# musl
77-
echo '--> installing musl libc' && \
78-
install --directory "${__SOURCE_DIR__}/musl/_build" && \
79-
curl --silent --location --retry 3 "https://musl.libc.org/releases/musl-latest.tar.gz" \
80-
| tar xz --no-same-owner --strip-components=1 -C "${__SOURCE_DIR__}/musl" && \
81-
cd "${__SOURCE_DIR__}/musl/_build" && \
82-
../configure \
83-
CFLAGS="-O2 -g0 -s -w -pipe -mtune=generic -DNDEBUG -DCLS=${DCACHE_LINESIZE}" \
84-
--prefix='/usr/local' \
85-
--disable-debug \
86-
--disable-shared \
87-
--enable-wrapper=all \
88-
--enable-static \
89-
> /dev/null && \
90-
make > /dev/null && \
91-
make install > /dev/null && \
92-
cd ~- && \
93-
rm -rf "${__SOURCE_DIR__}/musl" && \
87+
echo '--> installing musl libc' && \
88+
install --directory "${__SOURCE_DIR__}/musl/_build" && \
89+
curl --silent --location --retry 3 "https://musl.libc.org/releases/musl-latest.tar.gz" \
90+
| tar xz --no-same-owner --strip-components=1 -C "${__SOURCE_DIR__}/musl" && \
91+
cd "${__SOURCE_DIR__}/musl/_build" && \
92+
../configure \
93+
CFLAGS="-O2 -g0 -s -w -pipe -mtune=generic -DNDEBUG -DCLS=${DCACHE_LINESIZE}" \
94+
--prefix='/usr/local' \
95+
--disable-debug \
96+
--disable-shared \
97+
--enable-wrapper=all \
98+
--enable-static \
99+
> /dev/null && \
100+
make > /dev/null && \
101+
make install > /dev/null && \
102+
# Applications linked against all musl public header files and crt files are allowed to
103+
# omit copyright notice and permission notice otherwise required by the license.
104+
# This is documented in the "COPYRIGHT" file.
105+
# https://git.musl-libc.org/cgit/musl/tree/COPYRIGHT
106+
cd ~- && \
107+
rm -rf "${__SOURCE_DIR__}/musl" && \
94108
# zlib
95-
echo '--> installing zlib' && \
96-
ZLIB_VERSION="$(rpm -q --qf "%{VERSION}" zlib)" && \
97-
install --directory "${__SOURCE_DIR__}/zlib/_build" && \
98-
curl --silent --location --retry 3 "https://zlib.net/zlib-${ZLIB_VERSION}.tar.gz" \
99-
| tar xz --no-same-owner --strip-components=1 -C "${__SOURCE_DIR__}/zlib" && \
100-
cd "${__SOURCE_DIR__}/zlib/_build" && \
101-
sed -i.orig -e '/(man3dir)/d' ../Makefile.in && \
102-
CC="musl-gcc -static --static" \
103-
CFLAGS="-O2 -g0 -s -w -pipe -mtune=generic -DNDEBUG -DCLS=${DCACHE_LINESIZE}" \
104-
../configure \
105-
--prefix='/usr/local' \
106-
--includedir='/usr/local/include' \
107-
--libdir='/usr/local/lib' \
108-
--static \
109-
> /dev/null && \
110-
make > /dev/null && \
111-
make install > /dev/null && \
112-
cd ~- && \
113-
rm -rf "${__SOURCE_DIR__}/zlib" && \
114-
# openssl
115-
echo '--> installing openssl' && \
116-
OPENSSL_VERSION="$(rpm -q --qf "%{VERSION}" openssl-libs)" && \
117-
install --directory "${__SOURCE_DIR__}/openssl/_build" && \
118-
curl --silent --location --retry 3 "https://www.openssl.org/source/openssl-${OPENSSL_VERSION}.tar.gz" \
119-
| tar xz --no-same-owner --strip-components=1 -C "${__SOURCE_DIR__}/openssl" && \
120-
cd "${__SOURCE_DIR__}/openssl/_build" && \
121-
../config \
122-
CC="musl-gcc -static --static" \
123-
--openssldir='/etc/ssl' \
124-
--prefix='/usr/local' \
125-
--libdir='/usr/local/lib' \
126-
--release \
127-
--static \
128-
enable-cms \
129-
enable-ec_nistp_64_gcc_128 \
130-
enable-rfc3779 \
131-
no-comp \
132-
no-shared \
133-
no-ssl3 \
134-
no-weak-ssl-ciphers \
135-
zlib \
136-
-pipe \
137-
-static \
138-
-DCLS=${DCACHE_LINESIZE} \
139-
-DNDEBUG \
140-
-DOPENSSL_NO_HEARTBEATS \
141-
-O2 -g0 -s -w -pipe -m64 -mtune=generic '-DDEVRANDOM="\"/dev/urandom\""' && \
142-
make > /dev/null && \
143-
make install_sw > /dev/null && \
144-
make install_ssldirs > /dev/null && \
145-
cd ~- && \
146-
rm -rf "${__SOURCE_DIR__}/openssl" && \
147-
# redis
148-
echo '--> installing redis' && \
149-
install --directory "${__SOURCE_DIR__}/redis" && \
150-
curl --silent --location --retry 3 "https://download.redis.io/releases/redis-${REDIS_VERSION}.tar.gz" \
151-
| tar xz --no-same-owner --strip-components=1 -C "${__SOURCE_DIR__}/redis" && \
152-
cd "${__SOURCE_DIR__}/redis" && \
153-
sed -i.orig -e '/createBoolConfig.*protected-mode/ s/protected_mode, 1/protected_mode, 0/' ./src/config.c && \
154-
__arch__="$(arch)" && \
155-
__arch_pagesize__="$(rpm --eval '%{arm} %{ix86} x86_64 s390x')" && \
156-
eval "case '${__arch__}' in ${__arch_pagesize__// /|}) EXTRA_ARGS='--with-lg-page=12' ;; *) EXTRA_ARGS='--with-lg-page=16' ;; esac" && \
157-
EXTRA_ARGS="${EXTRA_ARGS} --with-lg-hugepage=21" && \
158-
sed -i.orig -e "/cd jemalloc \&\& \.\/configure/ s/configure/configure ${EXTRA_ARGS}/" ./deps/Makefile && \
159-
unset __arch__ __arch_pagesize__ EXTRA_ARGS && \
160-
make \
161-
PREFIX="/usr" \
109+
echo '--> installing zlib' && \
110+
ZLIB_VERSION="$(rpm -q --qf "%{VERSION}" zlib)" && \
111+
install --directory "${__SOURCE_DIR__}/zlib/_build" && \
112+
curl --silent --location --retry 3 "https://zlib.net/fossils/zlib-${ZLIB_VERSION}.tar.gz" \
113+
| tar xz --no-same-owner --strip-components=1 -C "${__SOURCE_DIR__}/zlib" && \
114+
cd "${__SOURCE_DIR__}/zlib/_build" && \
115+
sed -i.orig -e '/(man3dir)/d' ../Makefile.in && \
162116
CC="musl-gcc -static --static" \
163117
CFLAGS="-O2 -g0 -s -w -pipe -mtune=generic -DNDEBUG -DCLS=${DCACHE_LINESIZE}" \
164-
BUILD_TLS="yes" \
165-
> /dev/null && \
166-
make PREFIX="${__BUILD_DIR__}/usr" install > /dev/null && \
167-
install --directory --owner="${__USER__}" --group="${__USER__}" --mode=0755 "${__BUILD_DIR__}/licenses/redis" && \
168-
install --owner="${__USER__}" --group="${__USER__}" --mode=0644 --target-directory="${__BUILD_DIR__}/licenses/redis" './COPYING' && \
169-
cd ~- && \
170-
rm -rf "${__SOURCE_DIR__}/redis" && \
118+
../configure \
119+
--prefix='/usr/local' \
120+
--includedir='/usr/local/include' \
121+
--libdir='/usr/local/lib' \
122+
--static \
123+
> /dev/null && \
124+
make > /dev/null && \
125+
make install > /dev/null && \
126+
install --directory --owner="${__USER__}" --group="${__USER__}" --mode=0755 "${__BUILD_DIR__}/licenses/zlib" && \
127+
install --owner="${__USER__}" --group="${__USER__}" --mode=0644 --target-directory="${__BUILD_DIR__}/licenses/zlib" '../README' && \
128+
(cd .. && find ./ -type f -a \( -iname '*LICENSE*' -o -iname '*COPYING*' \) -exec cp --parents {} "${__BUILD_DIR__}/licenses/zlib" ';') && \
129+
cd ~- && \
130+
rm -rf "${__SOURCE_DIR__}/zlib" && \
131+
# openssl
132+
echo '--> installing openssl' && \
133+
OPENSSL_VERSION="$(rpm -q --qf "%{VERSION}" openssl-libs)" && \
134+
install --directory "${__SOURCE_DIR__}/openssl/_build" && \
135+
curl --silent --location --retry 3 "https://www.openssl.org/source/openssl-${OPENSSL_VERSION}.tar.gz" \
136+
| tar xz --no-same-owner --strip-components=1 -C "${__SOURCE_DIR__}/openssl" && \
137+
cd "${__SOURCE_DIR__}/openssl/_build" && \
138+
../config \
139+
CC="musl-gcc -static --static" \
140+
--openssldir='/etc/ssl' \
141+
--prefix='/usr/local' \
142+
--libdir='/usr/local/lib' \
143+
--release \
144+
--static \
145+
enable-cms \
146+
enable-ec_nistp_64_gcc_128 \
147+
enable-rfc3779 \
148+
no-comp \
149+
no-shared \
150+
no-ssl3 \
151+
no-weak-ssl-ciphers \
152+
zlib \
153+
-pipe \
154+
-static \
155+
-DCLS=${DCACHE_LINESIZE} \
156+
-DNDEBUG \
157+
-DOPENSSL_NO_HEARTBEATS \
158+
-O2 -g0 -s -w -pipe -m64 -mtune=generic '-DDEVRANDOM="\"/dev/urandom\""' && \
159+
make > /dev/null && \
160+
make install_sw > /dev/null && \
161+
make install_ssldirs > /dev/null && \
162+
install --directory --owner="${__USER__}" --group="${__USER__}" --mode=0755 "${__BUILD_DIR__}/licenses/openssl" && \
163+
(cd .. && find ./ -type f -a \( -iname '*LICENSE*' -o -iname '*COPYING*' \) -exec cp --parents {} "${__BUILD_DIR__}/licenses/openssl" ';') && \
164+
cd ~- && \
165+
rm -rf "${__SOURCE_DIR__}/openssl" && \
166+
# redis
167+
echo '--> installing redis' && \
168+
install --directory "${__SOURCE_DIR__}/redis" && \
169+
curl --silent --location --retry 3 "https://download.redis.io/releases/redis-${REDIS_VERSION}.tar.gz" \
170+
| tar xz --no-same-owner --strip-components=1 -C "${__SOURCE_DIR__}/redis" && \
171+
cd "${__SOURCE_DIR__}/redis" && \
172+
sed -i.orig -e '/createBoolConfig.*protected-mode/ s/protected_mode, 1/protected_mode, 0/' ./src/config.c && \
173+
__arch__="$(arch)" && \
174+
__arch_pagesize__="$(rpm --eval '%{arm} %{ix86} x86_64 s390x')" && \
175+
eval "case '${__arch__}' in ${__arch_pagesize__// /|}) EXTRA_ARGS='--with-lg-page=12' ;; *) EXTRA_ARGS='--with-lg-page=16' ;; esac" && \
176+
EXTRA_ARGS="${EXTRA_ARGS} --with-lg-hugepage=21" && \
177+
sed -i.orig -e "/cd jemalloc \&\& \.\/configure/ s/configure/configure ${EXTRA_ARGS}/" ./deps/Makefile && \
178+
unset __arch__ __arch_pagesize__ EXTRA_ARGS && \
179+
make \
180+
PREFIX="/usr" \
181+
CC="musl-gcc -static --static" \
182+
CFLAGS="-O2 -g0 -s -w -pipe -mtune=generic -DNDEBUG -DCLS=${DCACHE_LINESIZE}" \
183+
BUILD_TLS="yes" \
184+
> /dev/null && \
185+
make PREFIX="${__BUILD_DIR__}/usr" install > /dev/null && \
186+
install --directory --owner="${__USER__}" --group="${__USER__}" --mode=0755 "${__BUILD_DIR__}/licenses/redis" && \
187+
install --owner="${__USER__}" --group="${__USER__}" --mode=0644 --target-directory="${__BUILD_DIR__}/licenses/redis" './COPYING' && \
188+
find ./ -type f -a \( -iname '*LICENSE*' -o -iname '*COPYING*' \) -exec cp --parents {} "${__BUILD_DIR__}/licenses/redis" ';' && \
189+
cd ~- && \
190+
rm -rf "${__SOURCE_DIR__}/redis" && \
171191
# stripping
172-
echo '--> stripping binaries' && \
173-
find "${__BUILD_DIR__}"/usr/bin -type f -not -links +1 -exec strip --strip-all {} ';' && \
192+
echo '--> stripping binaries' && \
193+
find "${__BUILD_DIR__}"/usr/bin -type f -not -links +1 -exec strip --strip-all {} ';' && \
174194
# symbolic links
175-
echo '--> replacing symbolic links' && \
176-
for s in $(find "${__BUILD_DIR__}"/usr/bin -type l); do \
177-
ln --force "$(readlink -m "${s}")" "${s}"; \
178-
done && \
195+
echo '--> replacing symbolic links' && \
196+
for s in $(find "${__BUILD_DIR__}"/usr/bin -type l); do \
197+
ln --force "$(readlink -m "${s}")" "${s}"; \
198+
done && \
179199
# alt links
180-
echo '--> creating alternative links' && \
181-
install --directory --owner="${__USER__}" --group="${__USER__}" --mode=0755 "${__BUILD_DIR__}/usr/local/bin" && \
182-
for app in $(find /build/usr/bin/ -name 'redis-*'); do \
183-
ln --force "${app}" "${__BUILD_DIR__}"/usr/local/bin/"${app#*-}"; \
184-
done && \
200+
echo '--> creating alternative links' && \
201+
install --directory --owner="${__USER__}" --group="${__USER__}" --mode=0755 "${__BUILD_DIR__}/usr/local/bin" && \
202+
for app in $(find /build/usr/bin/ -name 'redis-*'); do \
203+
ln --force "${app}" "${__BUILD_DIR__}"/usr/local/bin/"${app#*-}"; \
204+
done && \
185205
# licenses
186-
echo '--> project licenses' && \
187-
install --owner="${__USER__}" --group="${__USER__}" --mode=0644 --target-directory="${__BUILD_DIR__}/licenses" "${__WORK_DIR__}/LICENSE" && \
206+
echo '--> project licenses' && \
207+
install --owner="${__USER__}" --group="${__USER__}" --mode=0644 --target-directory="${__BUILD_DIR__}/licenses" "${__WORK_DIR__}/LICENSE" && \
188208
# done
189-
echo '--> all done!'
209+
echo '--> all done!'
190210

191211

192212

@@ -197,20 +217,20 @@ ARG __DATA_DIR__
197217
ARG REDIS_VERSION
198218

199219
LABEL \
200-
maintainer="Frederico Martins <https://hub.docker.com/u/fscm/>" \
201-
vendor="fscm" \
202-
cmd="docker container run --detach --publish 6379:6379/tcp fscm/redis server" \
203-
params="--volume $$PWD:${__DATA_DIR__}:rw" \
204-
org.label-schema.schema-version="1.0" \
205-
org.label-schema.name="fscm/redis" \
206-
org.label-schema.description="A small Redis image that can be used to start a Redis server" \
207-
org.label-schema.url="https://redis.io/" \
208-
org.label-schema.vcs-url="https://github.com/fscm/docker-redis/" \
209-
org.label-schema.vendor="fscm" \
210-
org.label-schema.version=${REDIS_VERSION} \
211-
org.label-schema.docker.cmd="docker container run --detach --rm --publish 6379:6379/tcp fscm/redis server" \
212-
org.label-schema.docker.cmd.test="docker container run --detach --rm --publish 6379:6379/tcp fscm/redis server --version" \
213-
org.label-schema.docker.params="--volume $$PWD:${__DATA_DIR__}:rw"
220+
maintainer="Frederico Martins <https://hub.docker.com/u/fscm/>" \
221+
vendor="fscm" \
222+
cmd="docker container run --detach --publish 6379:6379/tcp fscm/redis server" \
223+
params="--volume $$PWD:${__DATA_DIR__}:rw" \
224+
org.label-schema.schema-version="1.0" \
225+
org.label-schema.name="fscm/redis" \
226+
org.label-schema.description="A small Redis image that can be used to start a Redis server" \
227+
org.label-schema.url="https://redis.io/" \
228+
org.label-schema.vcs-url="https://github.com/fscm/docker-redis/" \
229+
org.label-schema.vendor="fscm" \
230+
org.label-schema.version=${REDIS_VERSION} \
231+
org.label-schema.docker.cmd="docker container run --detach --rm --publish 6379:6379/tcp fscm/redis server" \
232+
org.label-schema.docker.cmd.test="docker container run --detach --rm --publish 6379:6379/tcp fscm/redis server --version" \
233+
org.label-schema.docker.params="--volume $$PWD:${__DATA_DIR__}:rw"
214234

215235
EXPOSE 6379/tcp
216236

0 commit comments

Comments
 (0)