├── .gitattributes ├── .github └── workflows │ ├── ci.yml │ ├── nightly-unstable-package.yml │ └── verify-templating.yml ├── .gitignore ├── 6.2 ├── alpine │ ├── Dockerfile │ └── docker-entrypoint.sh └── debian │ ├── Dockerfile │ └── docker-entrypoint.sh ├── 7.0 ├── alpine │ ├── Dockerfile │ └── docker-entrypoint.sh └── debian │ ├── Dockerfile │ └── docker-entrypoint.sh ├── 7.2 ├── alpine │ ├── Dockerfile │ └── docker-entrypoint.sh └── debian │ ├── Dockerfile │ └── docker-entrypoint.sh ├── 7.4-rc ├── alpine │ ├── Dockerfile │ └── docker-entrypoint.sh └── debian │ ├── Dockerfile │ └── docker-entrypoint.sh ├── 7.4 ├── alpine │ ├── Dockerfile │ └── docker-entrypoint.sh └── debian │ ├── Dockerfile │ └── docker-entrypoint.sh ├── BUILD.md ├── Dockerfile.template ├── LICENSE ├── README.md ├── apply-templates.sh ├── docker-entrypoint.sh ├── generate-stackbrew-library-mac.sh ├── generate-stackbrew-library.sh ├── stackbrew-generated └── 7-4.txt ├── update.sh ├── versions.json └── versions.sh /.gitattributes: -------------------------------------------------------------------------------- 1 | /*/**/Dockerfile linguist-generated 2 | /*/**/docker-entrypoint.sh linguist-generated 3 | /Dockerfile*.template linguist-language=Dockerfile 4 | -------------------------------------------------------------------------------- /.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | name: GitHub CI 2 | 3 | on: 4 | pull_request: 5 | push: 6 | schedule: 7 | - cron: 0 0 * * 0 8 | 9 | defaults: 10 | run: 11 | shell: 'bash -Eeuo pipefail -x {0}' 12 | 13 | jobs: 14 | 15 | generate-jobs: 16 | name: Generate Jobs 17 | runs-on: ubuntu-latest 18 | outputs: 19 | strategy: ${{ steps.generate-jobs.outputs.strategy }} 20 | steps: 21 | - uses: actions/checkout@v3 22 | - uses: docker-library/bashbrew@HEAD 23 | - id: generate-jobs 24 | name: Generate Jobs 25 | run: | 26 | strategy="$("$BASHBREW_SCRIPTS/github-actions/generate.sh")" 27 | echo "strategy=$strategy" >> "$GITHUB_OUTPUT" 28 | jq . <<<"$strategy" # sanity check / debugging aid 29 | 30 | test: 31 | needs: generate-jobs 32 | strategy: ${{ fromJson(needs.generate-jobs.outputs.strategy) }} 33 | name: ${{ matrix.name }} 34 | runs-on: ${{ matrix.os }} 35 | steps: 36 | - uses: actions/checkout@v3 37 | - name: Prepare Environment 38 | run: ${{ matrix.runs.prepare }} 39 | - name: Pull Dependencies 40 | run: ${{ matrix.runs.pull }} 41 | - name: Build ${{ matrix.name }} 42 | run: ${{ matrix.runs.build }} 43 | - name: History ${{ matrix.name }} 44 | run: ${{ matrix.runs.history }} 45 | - name: Test ${{ matrix.name }} 46 | run: ${{ matrix.runs.test }} 47 | - name: '"docker images"' 48 | run: ${{ matrix.runs.images }} 49 | -------------------------------------------------------------------------------- /.github/workflows/nightly-unstable-package.yml: -------------------------------------------------------------------------------- 1 | name: Nightly Unstable Build and Package 2 | 3 | on: 4 | schedule: 5 | - cron: '0 1 * * *' # Run every day at 1:00 AM UTC 6 | workflow_dispatch: # Allow manual triggering 7 | 8 | jobs: 9 | build-and-test-unstable: 10 | uses: ./.github/workflows/pre-merge.yml@unstable 11 | with: 12 | ref: 'unstable' 13 | -------------------------------------------------------------------------------- /.github/workflows/verify-templating.yml: -------------------------------------------------------------------------------- 1 | name: Verify Templating 2 | 3 | on: 4 | pull_request: 5 | push: 6 | 7 | defaults: 8 | run: 9 | shell: 'bash -Eeuo pipefail -x {0}' 10 | 11 | jobs: 12 | apply-templates: 13 | name: Check For Uncomitted Changes 14 | runs-on: ubuntu-latest 15 | steps: 16 | - uses: actions/checkout@v3 17 | - name: Apply Templates 18 | run: ./apply-templates.sh 19 | - name: Check Git Status 20 | run: | 21 | status="$(git status --short)" 22 | [ -z "$status" ] 23 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .jq-template.awk 2 | -------------------------------------------------------------------------------- /6.2/alpine/Dockerfile: -------------------------------------------------------------------------------- 1 | # 2 | # NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" 3 | # 4 | # PLEASE DO NOT EDIT IT DIRECTLY. 5 | # 6 | 7 | FROM alpine:3.21 8 | 9 | # add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added 10 | RUN set -eux; \ 11 | # alpine already has a gid 999, so we'll use the next id 12 | addgroup -S -g 1000 redis; \ 13 | adduser -S -G redis -u 999 redis 14 | 15 | # runtime dependencies 16 | RUN set -eux; \ 17 | apk add --no-cache \ 18 | # add tzdata for https://github.com/docker-library/redis/issues/138 19 | tzdata \ 20 | ; 21 | 22 | # grab gosu for easy step-down from root 23 | # https://github.com/tianon/gosu/releases 24 | ENV GOSU_VERSION 1.17 25 | RUN set -eux; \ 26 | apk add --no-cache --virtual .gosu-fetch gnupg; \ 27 | arch="$(apk --print-arch)"; \ 28 | case "$arch" in \ 29 | 'x86_64') url='https://github.com/tianon/gosu/releases/download/1.17/gosu-amd64'; sha256='bbc4136d03ab138b1ad66fa4fc051bafc6cc7ffae632b069a53657279a450de3' ;; \ 30 | 'aarch64') url='https://github.com/tianon/gosu/releases/download/1.17/gosu-arm64'; sha256='c3805a85d17f4454c23d7059bcb97e1ec1af272b90126e79ed002342de08389b' ;; \ 31 | 'armhf') url='https://github.com/tianon/gosu/releases/download/1.17/gosu-armhf'; sha256='e5866286277ff2a2159fb9196fea13e0a59d3f1091ea46ddb985160b94b6841b' ;; \ 32 | 'x86') url='https://github.com/tianon/gosu/releases/download/1.17/gosu-i386'; sha256='087dbb8fe479537e64f9c86fa49ff3b41dee1cbd28739a19aaef83dc8186b1ca' ;; \ 33 | 'ppc64le') url='https://github.com/tianon/gosu/releases/download/1.17/gosu-ppc64el'; sha256='1891acdcfa70046818ab6ed3c52b9d42fa10fbb7b340eb429c8c7849691dbd76' ;; \ 34 | 'riscv64') url='https://github.com/tianon/gosu/releases/download/1.17/gosu-riscv64'; sha256='38a6444b57adce135c42d5a3689f616fc7803ddc7a07ff6f946f2ebc67a26ba6' ;; \ 35 | 's390x') url='https://github.com/tianon/gosu/releases/download/1.17/gosu-s390x'; sha256='69873bab588192f760547ca1f75b27cfcf106e9f7403fee6fd0600bc914979d0' ;; \ 36 | 'armv7') url='https://github.com/tianon/gosu/releases/download/1.17/gosu-armhf'; sha256='e5866286277ff2a2159fb9196fea13e0a59d3f1091ea46ddb985160b94b6841b' ;; \ 37 | *) echo >&2 "error: unsupported gosu architecture: '$arch'"; exit 1 ;; \ 38 | esac; \ 39 | wget -O /usr/local/bin/gosu.asc "$url.asc"; \ 40 | wget -O /usr/local/bin/gosu "$url"; \ 41 | echo "$sha256 */usr/local/bin/gosu" | sha256sum -c -; \ 42 | export GNUPGHOME="$(mktemp -d)"; \ 43 | gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4; \ 44 | gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu; \ 45 | gpgconf --kill all; \ 46 | rm -rf "$GNUPGHOME" /usr/local/bin/gosu.asc; \ 47 | apk del --no-network .gosu-fetch; \ 48 | chmod +x /usr/local/bin/gosu; \ 49 | gosu --version; \ 50 | gosu nobody true 51 | 52 | ENV REDIS_VERSION 6.2.18 53 | ENV REDIS_DOWNLOAD_URL http://download.redis.io/releases/redis-6.2.18.tar.gz 54 | ENV REDIS_DOWNLOAD_SHA 470c75bac73d7390be4dd66479c6f29e86371c5d380ce0c7efb4ba2bbda3612d 55 | 56 | RUN set -eux; \ 57 | \ 58 | apk add --no-cache --virtual .build-deps \ 59 | coreutils \ 60 | dpkg-dev dpkg \ 61 | gcc \ 62 | linux-headers \ 63 | make \ 64 | musl-dev \ 65 | openssl-dev \ 66 | # install real "wget" to avoid: 67 | # + wget -O redis.tar.gz https://download.redis.io/releases/redis-x.y.z.tar.gz 68 | # Connecting to download.redis.io (45.60.121.1:80) 69 | # wget: bad header line: XxhODalH: btu; path=/; Max-Age=900 70 | wget \ 71 | ; \ 72 | \ 73 | wget -O redis.tar.gz "$REDIS_DOWNLOAD_URL"; \ 74 | echo "$REDIS_DOWNLOAD_SHA *redis.tar.gz" | sha256sum -c -; \ 75 | mkdir -p /usr/src/redis; \ 76 | tar -xzf redis.tar.gz -C /usr/src/redis --strip-components=1; \ 77 | rm redis.tar.gz; \ 78 | \ 79 | # disable Redis protected mode [1] as it is unnecessary in context of Docker 80 | # (ports are not automatically exposed when running inside Docker, but rather explicitly by specifying -p / -P) 81 | # [1]: https://github.com/redis/redis/commit/edd4d555df57dc84265fdfb4ef59a4678832f6da 82 | grep -E '^ *createBoolConfig[(]"protected-mode",.*, *1 *,.*[)],$' /usr/src/redis/src/config.c; \ 83 | sed -ri 's!^( *createBoolConfig[(]"protected-mode",.*, *)1( *,.*[)],)$!\10\2!' /usr/src/redis/src/config.c; \ 84 | grep -E '^ *createBoolConfig[(]"protected-mode",.*, *0 *,.*[)],$' /usr/src/redis/src/config.c; \ 85 | # 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" 86 | # see also https://github.com/docker-library/redis/issues/4#issuecomment-50780840 87 | # (more exactly, this makes sure the default behavior of "save on SIGTERM" stays functional by default) 88 | \ 89 | # https://github.com/jemalloc/jemalloc/issues/467 -- we need to patch the "./configure" for the bundled jemalloc to match how Debian compiles, for compatibility 90 | # (also, we do cross-builds, so we need to embed the appropriate "--build=xxx" values to that "./configure" invocation) 91 | gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ 92 | extraJemallocConfigureFlags="--build=$gnuArch"; \ 93 | # https://salsa.debian.org/debian/jemalloc/-/blob/c0a88c37a551be7d12e4863435365c9a6a51525f/debian/rules#L8-23 94 | dpkgArch="$(dpkg --print-architecture)"; \ 95 | case "${dpkgArch##*-}" in \ 96 | amd64 | i386 | x32) extraJemallocConfigureFlags="$extraJemallocConfigureFlags --with-lg-page=12" ;; \ 97 | *) extraJemallocConfigureFlags="$extraJemallocConfigureFlags --with-lg-page=16" ;; \ 98 | esac; \ 99 | extraJemallocConfigureFlags="$extraJemallocConfigureFlags --with-lg-hugepage=21"; \ 100 | grep -F 'cd jemalloc && ./configure ' /usr/src/redis/deps/Makefile; \ 101 | sed -ri 's!cd jemalloc && ./configure !&'"$extraJemallocConfigureFlags"' !' /usr/src/redis/deps/Makefile; \ 102 | grep -F "cd jemalloc && ./configure $extraJemallocConfigureFlags " /usr/src/redis/deps/Makefile; \ 103 | \ 104 | export BUILD_TLS=yes; \ 105 | make -C /usr/src/redis -j "$(nproc)" all; \ 106 | make -C /usr/src/redis install; \ 107 | \ 108 | # TODO https://github.com/redis/redis/pull/3494 (deduplicate "redis-server" copies) 109 | serverMd5="$(md5sum /usr/local/bin/redis-server | cut -d' ' -f1)"; export serverMd5; \ 110 | find /usr/local/bin/redis* -maxdepth 0 \ 111 | -type f -not -name redis-server \ 112 | -exec sh -eux -c ' \ 113 | md5="$(md5sum "$1" | cut -d" " -f1)"; \ 114 | test "$md5" = "$serverMd5"; \ 115 | ' -- '{}' ';' \ 116 | -exec ln -svfT 'redis-server' '{}' ';' \ 117 | ; \ 118 | \ 119 | rm -r /usr/src/redis; \ 120 | \ 121 | runDeps="$( \ 122 | scanelf --needed --nobanner --format '%n#p' --recursive /usr/local \ 123 | | tr ',' '\n' \ 124 | | sort -u \ 125 | | awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \ 126 | )"; \ 127 | apk add --no-network --virtual .redis-rundeps $runDeps; \ 128 | apk del --no-network .build-deps; \ 129 | \ 130 | redis-cli --version; \ 131 | redis-server --version 132 | 133 | RUN mkdir /data && chown redis:redis /data 134 | VOLUME /data 135 | WORKDIR /data 136 | 137 | COPY docker-entrypoint.sh /usr/local/bin/ 138 | ENTRYPOINT ["docker-entrypoint.sh"] 139 | 140 | EXPOSE 6379 141 | CMD ["redis-server"] 142 | -------------------------------------------------------------------------------- /6.2/alpine/docker-entrypoint.sh: -------------------------------------------------------------------------------- 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 | find . \! -user redis -exec chown redis '{}' + 13 | exec gosu redis "$0" "$@" 14 | fi 15 | 16 | # set an appropriate umask (if one isn't set already) 17 | # - https://github.com/docker-library/redis/issues/305 18 | # - https://github.com/redis/redis/blob/bb875603fb7ff3f9d19aad906bd45d7db98d9a39/utils/systemd-redis_server.service#L37 19 | um="$(umask)" 20 | if [ "$um" = '0022' ]; then 21 | umask 0077 22 | fi 23 | 24 | exec "$@" 25 | -------------------------------------------------------------------------------- /6.2/debian/Dockerfile: -------------------------------------------------------------------------------- 1 | # 2 | # NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" 3 | # 4 | # PLEASE DO NOT EDIT IT DIRECTLY. 5 | # 6 | 7 | FROM debian:bookworm-slim 8 | 9 | # add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added 10 | RUN set -eux; \ 11 | groupadd -r -g 999 redis; \ 12 | useradd -r -g redis -u 999 redis 13 | 14 | # runtime dependencies 15 | RUN set -eux; \ 16 | apt-get update; \ 17 | apt-get install -y --no-install-recommends \ 18 | # add tzdata explicitly for https://github.com/docker-library/redis/issues/138 (see also https://bugs.debian.org/837060 and related) 19 | tzdata \ 20 | ; \ 21 | rm -rf /var/lib/apt/lists/* 22 | 23 | # grab gosu for easy step-down from root 24 | # https://github.com/tianon/gosu/releases 25 | ENV GOSU_VERSION 1.17 26 | RUN set -eux; \ 27 | savedAptMark="$(apt-mark showmanual)"; \ 28 | apt-get update; \ 29 | apt-get install -y --no-install-recommends ca-certificates gnupg wget; \ 30 | rm -rf /var/lib/apt/lists/*; \ 31 | arch="$(dpkg --print-architecture | awk -F- '{ print $NF }')"; \ 32 | case "$arch" in \ 33 | 'amd64') url='https://github.com/tianon/gosu/releases/download/1.17/gosu-amd64'; sha256='bbc4136d03ab138b1ad66fa4fc051bafc6cc7ffae632b069a53657279a450de3' ;; \ 34 | 'arm64') url='https://github.com/tianon/gosu/releases/download/1.17/gosu-arm64'; sha256='c3805a85d17f4454c23d7059bcb97e1ec1af272b90126e79ed002342de08389b' ;; \ 35 | 'armel') url='https://github.com/tianon/gosu/releases/download/1.17/gosu-armel'; sha256='f9969910fa141140438c998cfa02f603bf213b11afd466dcde8fa940e700945d' ;; \ 36 | 'i386') url='https://github.com/tianon/gosu/releases/download/1.17/gosu-i386'; sha256='087dbb8fe479537e64f9c86fa49ff3b41dee1cbd28739a19aaef83dc8186b1ca' ;; \ 37 | 'mips64el') url='https://github.com/tianon/gosu/releases/download/1.17/gosu-mips64el'; sha256='87140029d792595e660be0015341dfa1c02d1181459ae40df9f093e471d75b70' ;; \ 38 | 'ppc64el') url='https://github.com/tianon/gosu/releases/download/1.17/gosu-ppc64el'; sha256='1891acdcfa70046818ab6ed3c52b9d42fa10fbb7b340eb429c8c7849691dbd76' ;; \ 39 | 'riscv64') url='https://github.com/tianon/gosu/releases/download/1.17/gosu-riscv64'; sha256='38a6444b57adce135c42d5a3689f616fc7803ddc7a07ff6f946f2ebc67a26ba6' ;; \ 40 | 's390x') url='https://github.com/tianon/gosu/releases/download/1.17/gosu-s390x'; sha256='69873bab588192f760547ca1f75b27cfcf106e9f7403fee6fd0600bc914979d0' ;; \ 41 | 'armhf') url='https://github.com/tianon/gosu/releases/download/1.17/gosu-armhf'; sha256='e5866286277ff2a2159fb9196fea13e0a59d3f1091ea46ddb985160b94b6841b' ;; \ 42 | *) echo >&2 "error: unsupported gosu architecture: '$arch'"; exit 1 ;; \ 43 | esac; \ 44 | wget -O /usr/local/bin/gosu.asc "$url.asc"; \ 45 | wget -O /usr/local/bin/gosu "$url"; \ 46 | echo "$sha256 */usr/local/bin/gosu" | sha256sum -c -; \ 47 | export GNUPGHOME="$(mktemp -d)"; \ 48 | gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4; \ 49 | gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu; \ 50 | gpgconf --kill all; \ 51 | rm -rf "$GNUPGHOME" /usr/local/bin/gosu.asc; \ 52 | apt-mark auto '.*' > /dev/null; \ 53 | [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark > /dev/null; \ 54 | apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ 55 | chmod +x /usr/local/bin/gosu; \ 56 | gosu --version; \ 57 | gosu nobody true 58 | 59 | ENV REDIS_VERSION 6.2.18 60 | ENV REDIS_DOWNLOAD_URL http://download.redis.io/releases/redis-6.2.18.tar.gz 61 | ENV REDIS_DOWNLOAD_SHA 470c75bac73d7390be4dd66479c6f29e86371c5d380ce0c7efb4ba2bbda3612d 62 | 63 | RUN set -eux; \ 64 | \ 65 | savedAptMark="$(apt-mark showmanual)"; \ 66 | apt-get update; \ 67 | apt-get install -y --no-install-recommends \ 68 | ca-certificates \ 69 | wget \ 70 | \ 71 | dpkg-dev \ 72 | gcc \ 73 | libc6-dev \ 74 | libssl-dev \ 75 | make \ 76 | ; \ 77 | rm -rf /var/lib/apt/lists/*; \ 78 | \ 79 | wget -O redis.tar.gz "$REDIS_DOWNLOAD_URL"; \ 80 | echo "$REDIS_DOWNLOAD_SHA *redis.tar.gz" | sha256sum -c -; \ 81 | mkdir -p /usr/src/redis; \ 82 | tar -xzf redis.tar.gz -C /usr/src/redis --strip-components=1; \ 83 | rm redis.tar.gz; \ 84 | \ 85 | # disable Redis protected mode [1] as it is unnecessary in context of Docker 86 | # (ports are not automatically exposed when running inside Docker, but rather explicitly by specifying -p / -P) 87 | # [1]: https://github.com/redis/redis/commit/edd4d555df57dc84265fdfb4ef59a4678832f6da 88 | grep -E '^ *createBoolConfig[(]"protected-mode",.*, *1 *,.*[)],$' /usr/src/redis/src/config.c; \ 89 | sed -ri 's!^( *createBoolConfig[(]"protected-mode",.*, *)1( *,.*[)],)$!\10\2!' /usr/src/redis/src/config.c; \ 90 | grep -E '^ *createBoolConfig[(]"protected-mode",.*, *0 *,.*[)],$' /usr/src/redis/src/config.c; \ 91 | # 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" 92 | # see also https://github.com/docker-library/redis/issues/4#issuecomment-50780840 93 | # (more exactly, this makes sure the default behavior of "save on SIGTERM" stays functional by default) 94 | \ 95 | # https://github.com/jemalloc/jemalloc/issues/467 -- we need to patch the "./configure" for the bundled jemalloc to match how Debian compiles, for compatibility 96 | # (also, we do cross-builds, so we need to embed the appropriate "--build=xxx" values to that "./configure" invocation) 97 | gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ 98 | extraJemallocConfigureFlags="--build=$gnuArch"; \ 99 | # https://salsa.debian.org/debian/jemalloc/-/blob/c0a88c37a551be7d12e4863435365c9a6a51525f/debian/rules#L8-23 100 | dpkgArch="$(dpkg --print-architecture)"; \ 101 | case "${dpkgArch##*-}" in \ 102 | amd64 | i386 | x32) extraJemallocConfigureFlags="$extraJemallocConfigureFlags --with-lg-page=12" ;; \ 103 | *) extraJemallocConfigureFlags="$extraJemallocConfigureFlags --with-lg-page=16" ;; \ 104 | esac; \ 105 | extraJemallocConfigureFlags="$extraJemallocConfigureFlags --with-lg-hugepage=21"; \ 106 | grep -F 'cd jemalloc && ./configure ' /usr/src/redis/deps/Makefile; \ 107 | sed -ri 's!cd jemalloc && ./configure !&'"$extraJemallocConfigureFlags"' !' /usr/src/redis/deps/Makefile; \ 108 | grep -F "cd jemalloc && ./configure $extraJemallocConfigureFlags " /usr/src/redis/deps/Makefile; \ 109 | \ 110 | export BUILD_TLS=yes; \ 111 | make -C /usr/src/redis -j "$(nproc)" all; \ 112 | make -C /usr/src/redis install; \ 113 | \ 114 | # TODO https://github.com/redis/redis/pull/3494 (deduplicate "redis-server" copies) 115 | serverMd5="$(md5sum /usr/local/bin/redis-server | cut -d' ' -f1)"; export serverMd5; \ 116 | find /usr/local/bin/redis* -maxdepth 0 \ 117 | -type f -not -name redis-server \ 118 | -exec sh -eux -c ' \ 119 | md5="$(md5sum "$1" | cut -d" " -f1)"; \ 120 | test "$md5" = "$serverMd5"; \ 121 | ' -- '{}' ';' \ 122 | -exec ln -svfT 'redis-server' '{}' ';' \ 123 | ; \ 124 | \ 125 | rm -r /usr/src/redis; \ 126 | \ 127 | apt-mark auto '.*' > /dev/null; \ 128 | [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark > /dev/null; \ 129 | find /usr/local -type f -executable -exec ldd '{}' ';' \ 130 | | awk '/=>/ { so = $(NF-1); if (index(so, "/usr/local/") == 1) { next }; gsub("^/(usr/)?", "", so); printf "*%s\n", so }' \ 131 | | sort -u \ 132 | | xargs -r dpkg-query --search \ 133 | | cut -d: -f1 \ 134 | | sort -u \ 135 | | xargs -r apt-mark manual \ 136 | ; \ 137 | apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ 138 | \ 139 | redis-cli --version; \ 140 | redis-server --version 141 | 142 | RUN mkdir /data && chown redis:redis /data 143 | VOLUME /data 144 | WORKDIR /data 145 | 146 | COPY docker-entrypoint.sh /usr/local/bin/ 147 | ENTRYPOINT ["docker-entrypoint.sh"] 148 | 149 | EXPOSE 6379 150 | CMD ["redis-server"] 151 | -------------------------------------------------------------------------------- /6.2/debian/docker-entrypoint.sh: -------------------------------------------------------------------------------- 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 | find . \! -user redis -exec chown redis '{}' + 13 | exec gosu redis "$0" "$@" 14 | fi 15 | 16 | # set an appropriate umask (if one isn't set already) 17 | # - https://github.com/docker-library/redis/issues/305 18 | # - https://github.com/redis/redis/blob/bb875603fb7ff3f9d19aad906bd45d7db98d9a39/utils/systemd-redis_server.service#L37 19 | um="$(umask)" 20 | if [ "$um" = '0022' ]; then 21 | umask 0077 22 | fi 23 | 24 | exec "$@" 25 | -------------------------------------------------------------------------------- /7.0/alpine/Dockerfile: -------------------------------------------------------------------------------- 1 | # 2 | # NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" 3 | # 4 | # PLEASE DO NOT EDIT IT DIRECTLY. 5 | # 6 | 7 | FROM alpine:3.21 8 | 9 | # add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added 10 | RUN set -eux; \ 11 | # alpine already has a gid 999, so we'll use the next id 12 | addgroup -S -g 1000 redis; \ 13 | adduser -S -G redis -u 999 redis 14 | 15 | # runtime dependencies 16 | RUN set -eux; \ 17 | apk add --no-cache \ 18 | # add tzdata for https://github.com/docker-library/redis/issues/138 19 | tzdata \ 20 | ; 21 | 22 | # grab gosu for easy step-down from root 23 | # https://github.com/tianon/gosu/releases 24 | ENV GOSU_VERSION 1.17 25 | RUN set -eux; \ 26 | apk add --no-cache --virtual .gosu-fetch gnupg; \ 27 | arch="$(apk --print-arch)"; \ 28 | case "$arch" in \ 29 | 'x86_64') url='https://github.com/tianon/gosu/releases/download/1.17/gosu-amd64'; sha256='bbc4136d03ab138b1ad66fa4fc051bafc6cc7ffae632b069a53657279a450de3' ;; \ 30 | 'aarch64') url='https://github.com/tianon/gosu/releases/download/1.17/gosu-arm64'; sha256='c3805a85d17f4454c23d7059bcb97e1ec1af272b90126e79ed002342de08389b' ;; \ 31 | 'armhf') url='https://github.com/tianon/gosu/releases/download/1.17/gosu-armhf'; sha256='e5866286277ff2a2159fb9196fea13e0a59d3f1091ea46ddb985160b94b6841b' ;; \ 32 | 'x86') url='https://github.com/tianon/gosu/releases/download/1.17/gosu-i386'; sha256='087dbb8fe479537e64f9c86fa49ff3b41dee1cbd28739a19aaef83dc8186b1ca' ;; \ 33 | 'ppc64le') url='https://github.com/tianon/gosu/releases/download/1.17/gosu-ppc64el'; sha256='1891acdcfa70046818ab6ed3c52b9d42fa10fbb7b340eb429c8c7849691dbd76' ;; \ 34 | 'riscv64') url='https://github.com/tianon/gosu/releases/download/1.17/gosu-riscv64'; sha256='38a6444b57adce135c42d5a3689f616fc7803ddc7a07ff6f946f2ebc67a26ba6' ;; \ 35 | 's390x') url='https://github.com/tianon/gosu/releases/download/1.17/gosu-s390x'; sha256='69873bab588192f760547ca1f75b27cfcf106e9f7403fee6fd0600bc914979d0' ;; \ 36 | 'armv7') url='https://github.com/tianon/gosu/releases/download/1.17/gosu-armhf'; sha256='e5866286277ff2a2159fb9196fea13e0a59d3f1091ea46ddb985160b94b6841b' ;; \ 37 | *) echo >&2 "error: unsupported gosu architecture: '$arch'"; exit 1 ;; \ 38 | esac; \ 39 | wget -O /usr/local/bin/gosu.asc "$url.asc"; \ 40 | wget -O /usr/local/bin/gosu "$url"; \ 41 | echo "$sha256 */usr/local/bin/gosu" | sha256sum -c -; \ 42 | export GNUPGHOME="$(mktemp -d)"; \ 43 | gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4; \ 44 | gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu; \ 45 | gpgconf --kill all; \ 46 | rm -rf "$GNUPGHOME" /usr/local/bin/gosu.asc; \ 47 | apk del --no-network .gosu-fetch; \ 48 | chmod +x /usr/local/bin/gosu; \ 49 | gosu --version; \ 50 | gosu nobody true 51 | 52 | ENV REDIS_VERSION 7.0.15 53 | ENV REDIS_DOWNLOAD_URL http://download.redis.io/releases/redis-7.0.15.tar.gz 54 | ENV REDIS_DOWNLOAD_SHA 98066f5363504b26c34dd20fbcc3c957990d764cdf42576c836fc021073f4341 55 | 56 | RUN set -eux; \ 57 | \ 58 | apk add --no-cache --virtual .build-deps \ 59 | coreutils \ 60 | dpkg-dev dpkg \ 61 | gcc \ 62 | linux-headers \ 63 | make \ 64 | musl-dev \ 65 | openssl-dev \ 66 | # install real "wget" to avoid: 67 | # + wget -O redis.tar.gz https://download.redis.io/releases/redis-x.y.z.tar.gz 68 | # Connecting to download.redis.io (45.60.121.1:80) 69 | # wget: bad header line: XxhODalH: btu; path=/; Max-Age=900 70 | wget \ 71 | ; \ 72 | \ 73 | wget -O redis.tar.gz "$REDIS_DOWNLOAD_URL"; \ 74 | echo "$REDIS_DOWNLOAD_SHA *redis.tar.gz" | sha256sum -c -; \ 75 | mkdir -p /usr/src/redis; \ 76 | tar -xzf redis.tar.gz -C /usr/src/redis --strip-components=1; \ 77 | rm redis.tar.gz; \ 78 | \ 79 | # disable Redis protected mode [1] as it is unnecessary in context of Docker 80 | # (ports are not automatically exposed when running inside Docker, but rather explicitly by specifying -p / -P) 81 | # [1]: https://github.com/redis/redis/commit/edd4d555df57dc84265fdfb4ef59a4678832f6da 82 | grep -E '^ *createBoolConfig[(]"protected-mode",.*, *1 *,.*[)],$' /usr/src/redis/src/config.c; \ 83 | sed -ri 's!^( *createBoolConfig[(]"protected-mode",.*, *)1( *,.*[)],)$!\10\2!' /usr/src/redis/src/config.c; \ 84 | grep -E '^ *createBoolConfig[(]"protected-mode",.*, *0 *,.*[)],$' /usr/src/redis/src/config.c; \ 85 | # 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" 86 | # see also https://github.com/docker-library/redis/issues/4#issuecomment-50780840 87 | # (more exactly, this makes sure the default behavior of "save on SIGTERM" stays functional by default) 88 | \ 89 | # https://github.com/jemalloc/jemalloc/issues/467 -- we need to patch the "./configure" for the bundled jemalloc to match how Debian compiles, for compatibility 90 | # (also, we do cross-builds, so we need to embed the appropriate "--build=xxx" values to that "./configure" invocation) 91 | gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ 92 | extraJemallocConfigureFlags="--build=$gnuArch"; \ 93 | # https://salsa.debian.org/debian/jemalloc/-/blob/c0a88c37a551be7d12e4863435365c9a6a51525f/debian/rules#L8-23 94 | dpkgArch="$(dpkg --print-architecture)"; \ 95 | case "${dpkgArch##*-}" in \ 96 | amd64 | i386 | x32) extraJemallocConfigureFlags="$extraJemallocConfigureFlags --with-lg-page=12" ;; \ 97 | *) extraJemallocConfigureFlags="$extraJemallocConfigureFlags --with-lg-page=16" ;; \ 98 | esac; \ 99 | extraJemallocConfigureFlags="$extraJemallocConfigureFlags --with-lg-hugepage=21"; \ 100 | grep -F 'cd jemalloc && ./configure ' /usr/src/redis/deps/Makefile; \ 101 | sed -ri 's!cd jemalloc && ./configure !&'"$extraJemallocConfigureFlags"' !' /usr/src/redis/deps/Makefile; \ 102 | grep -F "cd jemalloc && ./configure $extraJemallocConfigureFlags " /usr/src/redis/deps/Makefile; \ 103 | \ 104 | export BUILD_TLS=yes; \ 105 | make -C /usr/src/redis -j "$(nproc)" all; \ 106 | make -C /usr/src/redis install; \ 107 | \ 108 | # TODO https://github.com/redis/redis/pull/3494 (deduplicate "redis-server" copies) 109 | serverMd5="$(md5sum /usr/local/bin/redis-server | cut -d' ' -f1)"; export serverMd5; \ 110 | find /usr/local/bin/redis* -maxdepth 0 \ 111 | -type f -not -name redis-server \ 112 | -exec sh -eux -c ' \ 113 | md5="$(md5sum "$1" | cut -d" " -f1)"; \ 114 | test "$md5" = "$serverMd5"; \ 115 | ' -- '{}' ';' \ 116 | -exec ln -svfT 'redis-server' '{}' ';' \ 117 | ; \ 118 | \ 119 | rm -r /usr/src/redis; \ 120 | \ 121 | runDeps="$( \ 122 | scanelf --needed --nobanner --format '%n#p' --recursive /usr/local \ 123 | | tr ',' '\n' \ 124 | | sort -u \ 125 | | awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \ 126 | )"; \ 127 | apk add --no-network --virtual .redis-rundeps $runDeps; \ 128 | apk del --no-network .build-deps; \ 129 | \ 130 | redis-cli --version; \ 131 | redis-server --version 132 | 133 | RUN mkdir /data && chown redis:redis /data 134 | VOLUME /data 135 | WORKDIR /data 136 | 137 | COPY docker-entrypoint.sh /usr/local/bin/ 138 | ENTRYPOINT ["docker-entrypoint.sh"] 139 | 140 | EXPOSE 6379 141 | CMD ["redis-server"] 142 | -------------------------------------------------------------------------------- /7.0/alpine/docker-entrypoint.sh: -------------------------------------------------------------------------------- 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 | find . \! -user redis -exec chown redis '{}' + 13 | exec gosu redis "$0" "$@" 14 | fi 15 | 16 | # set an appropriate umask (if one isn't set already) 17 | # - https://github.com/docker-library/redis/issues/305 18 | # - https://github.com/redis/redis/blob/bb875603fb7ff3f9d19aad906bd45d7db98d9a39/utils/systemd-redis_server.service#L37 19 | um="$(umask)" 20 | if [ "$um" = '0022' ]; then 21 | umask 0077 22 | fi 23 | 24 | exec "$@" 25 | -------------------------------------------------------------------------------- /7.0/debian/Dockerfile: -------------------------------------------------------------------------------- 1 | # 2 | # NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" 3 | # 4 | # PLEASE DO NOT EDIT IT DIRECTLY. 5 | # 6 | 7 | FROM debian:bookworm-slim 8 | 9 | # add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added 10 | RUN set -eux; \ 11 | groupadd -r -g 999 redis; \ 12 | useradd -r -g redis -u 999 redis 13 | 14 | # runtime dependencies 15 | RUN set -eux; \ 16 | apt-get update; \ 17 | apt-get install -y --no-install-recommends \ 18 | # add tzdata explicitly for https://github.com/docker-library/redis/issues/138 (see also https://bugs.debian.org/837060 and related) 19 | tzdata \ 20 | ; \ 21 | rm -rf /var/lib/apt/lists/* 22 | 23 | # grab gosu for easy step-down from root 24 | # https://github.com/tianon/gosu/releases 25 | ENV GOSU_VERSION 1.17 26 | RUN set -eux; \ 27 | savedAptMark="$(apt-mark showmanual)"; \ 28 | apt-get update; \ 29 | apt-get install -y --no-install-recommends ca-certificates gnupg wget; \ 30 | rm -rf /var/lib/apt/lists/*; \ 31 | arch="$(dpkg --print-architecture | awk -F- '{ print $NF }')"; \ 32 | case "$arch" in \ 33 | 'amd64') url='https://github.com/tianon/gosu/releases/download/1.17/gosu-amd64'; sha256='bbc4136d03ab138b1ad66fa4fc051bafc6cc7ffae632b069a53657279a450de3' ;; \ 34 | 'arm64') url='https://github.com/tianon/gosu/releases/download/1.17/gosu-arm64'; sha256='c3805a85d17f4454c23d7059bcb97e1ec1af272b90126e79ed002342de08389b' ;; \ 35 | 'armel') url='https://github.com/tianon/gosu/releases/download/1.17/gosu-armel'; sha256='f9969910fa141140438c998cfa02f603bf213b11afd466dcde8fa940e700945d' ;; \ 36 | 'i386') url='https://github.com/tianon/gosu/releases/download/1.17/gosu-i386'; sha256='087dbb8fe479537e64f9c86fa49ff3b41dee1cbd28739a19aaef83dc8186b1ca' ;; \ 37 | 'mips64el') url='https://github.com/tianon/gosu/releases/download/1.17/gosu-mips64el'; sha256='87140029d792595e660be0015341dfa1c02d1181459ae40df9f093e471d75b70' ;; \ 38 | 'ppc64el') url='https://github.com/tianon/gosu/releases/download/1.17/gosu-ppc64el'; sha256='1891acdcfa70046818ab6ed3c52b9d42fa10fbb7b340eb429c8c7849691dbd76' ;; \ 39 | 'riscv64') url='https://github.com/tianon/gosu/releases/download/1.17/gosu-riscv64'; sha256='38a6444b57adce135c42d5a3689f616fc7803ddc7a07ff6f946f2ebc67a26ba6' ;; \ 40 | 's390x') url='https://github.com/tianon/gosu/releases/download/1.17/gosu-s390x'; sha256='69873bab588192f760547ca1f75b27cfcf106e9f7403fee6fd0600bc914979d0' ;; \ 41 | 'armhf') url='https://github.com/tianon/gosu/releases/download/1.17/gosu-armhf'; sha256='e5866286277ff2a2159fb9196fea13e0a59d3f1091ea46ddb985160b94b6841b' ;; \ 42 | *) echo >&2 "error: unsupported gosu architecture: '$arch'"; exit 1 ;; \ 43 | esac; \ 44 | wget -O /usr/local/bin/gosu.asc "$url.asc"; \ 45 | wget -O /usr/local/bin/gosu "$url"; \ 46 | echo "$sha256 */usr/local/bin/gosu" | sha256sum -c -; \ 47 | export GNUPGHOME="$(mktemp -d)"; \ 48 | gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4; \ 49 | gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu; \ 50 | gpgconf --kill all; \ 51 | rm -rf "$GNUPGHOME" /usr/local/bin/gosu.asc; \ 52 | apt-mark auto '.*' > /dev/null; \ 53 | [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark > /dev/null; \ 54 | apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ 55 | chmod +x /usr/local/bin/gosu; \ 56 | gosu --version; \ 57 | gosu nobody true 58 | 59 | ENV REDIS_VERSION 7.0.15 60 | ENV REDIS_DOWNLOAD_URL http://download.redis.io/releases/redis-7.0.15.tar.gz 61 | ENV REDIS_DOWNLOAD_SHA 98066f5363504b26c34dd20fbcc3c957990d764cdf42576c836fc021073f4341 62 | 63 | RUN set -eux; \ 64 | \ 65 | savedAptMark="$(apt-mark showmanual)"; \ 66 | apt-get update; \ 67 | apt-get install -y --no-install-recommends \ 68 | ca-certificates \ 69 | wget \ 70 | \ 71 | dpkg-dev \ 72 | gcc \ 73 | libc6-dev \ 74 | libssl-dev \ 75 | make \ 76 | ; \ 77 | rm -rf /var/lib/apt/lists/*; \ 78 | \ 79 | wget -O redis.tar.gz "$REDIS_DOWNLOAD_URL"; \ 80 | echo "$REDIS_DOWNLOAD_SHA *redis.tar.gz" | sha256sum -c -; \ 81 | mkdir -p /usr/src/redis; \ 82 | tar -xzf redis.tar.gz -C /usr/src/redis --strip-components=1; \ 83 | rm redis.tar.gz; \ 84 | \ 85 | # disable Redis protected mode [1] as it is unnecessary in context of Docker 86 | # (ports are not automatically exposed when running inside Docker, but rather explicitly by specifying -p / -P) 87 | # [1]: https://github.com/redis/redis/commit/edd4d555df57dc84265fdfb4ef59a4678832f6da 88 | grep -E '^ *createBoolConfig[(]"protected-mode",.*, *1 *,.*[)],$' /usr/src/redis/src/config.c; \ 89 | sed -ri 's!^( *createBoolConfig[(]"protected-mode",.*, *)1( *,.*[)],)$!\10\2!' /usr/src/redis/src/config.c; \ 90 | grep -E '^ *createBoolConfig[(]"protected-mode",.*, *0 *,.*[)],$' /usr/src/redis/src/config.c; \ 91 | # 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" 92 | # see also https://github.com/docker-library/redis/issues/4#issuecomment-50780840 93 | # (more exactly, this makes sure the default behavior of "save on SIGTERM" stays functional by default) 94 | \ 95 | # https://github.com/jemalloc/jemalloc/issues/467 -- we need to patch the "./configure" for the bundled jemalloc to match how Debian compiles, for compatibility 96 | # (also, we do cross-builds, so we need to embed the appropriate "--build=xxx" values to that "./configure" invocation) 97 | gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ 98 | extraJemallocConfigureFlags="--build=$gnuArch"; \ 99 | # https://salsa.debian.org/debian/jemalloc/-/blob/c0a88c37a551be7d12e4863435365c9a6a51525f/debian/rules#L8-23 100 | dpkgArch="$(dpkg --print-architecture)"; \ 101 | case "${dpkgArch##*-}" in \ 102 | amd64 | i386 | x32) extraJemallocConfigureFlags="$extraJemallocConfigureFlags --with-lg-page=12" ;; \ 103 | *) extraJemallocConfigureFlags="$extraJemallocConfigureFlags --with-lg-page=16" ;; \ 104 | esac; \ 105 | extraJemallocConfigureFlags="$extraJemallocConfigureFlags --with-lg-hugepage=21"; \ 106 | grep -F 'cd jemalloc && ./configure ' /usr/src/redis/deps/Makefile; \ 107 | sed -ri 's!cd jemalloc && ./configure !&'"$extraJemallocConfigureFlags"' !' /usr/src/redis/deps/Makefile; \ 108 | grep -F "cd jemalloc && ./configure $extraJemallocConfigureFlags " /usr/src/redis/deps/Makefile; \ 109 | \ 110 | export BUILD_TLS=yes; \ 111 | make -C /usr/src/redis -j "$(nproc)" all; \ 112 | make -C /usr/src/redis install; \ 113 | \ 114 | # TODO https://github.com/redis/redis/pull/3494 (deduplicate "redis-server" copies) 115 | serverMd5="$(md5sum /usr/local/bin/redis-server | cut -d' ' -f1)"; export serverMd5; \ 116 | find /usr/local/bin/redis* -maxdepth 0 \ 117 | -type f -not -name redis-server \ 118 | -exec sh -eux -c ' \ 119 | md5="$(md5sum "$1" | cut -d" " -f1)"; \ 120 | test "$md5" = "$serverMd5"; \ 121 | ' -- '{}' ';' \ 122 | -exec ln -svfT 'redis-server' '{}' ';' \ 123 | ; \ 124 | \ 125 | rm -r /usr/src/redis; \ 126 | \ 127 | apt-mark auto '.*' > /dev/null; \ 128 | [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark > /dev/null; \ 129 | find /usr/local -type f -executable -exec ldd '{}' ';' \ 130 | | awk '/=>/ { so = $(NF-1); if (index(so, "/usr/local/") == 1) { next }; gsub("^/(usr/)?", "", so); printf "*%s\n", so }' \ 131 | | sort -u \ 132 | | xargs -r dpkg-query --search \ 133 | | cut -d: -f1 \ 134 | | sort -u \ 135 | | xargs -r apt-mark manual \ 136 | ; \ 137 | apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ 138 | \ 139 | redis-cli --version; \ 140 | redis-server --version 141 | 142 | RUN mkdir /data && chown redis:redis /data 143 | VOLUME /data 144 | WORKDIR /data 145 | 146 | COPY docker-entrypoint.sh /usr/local/bin/ 147 | ENTRYPOINT ["docker-entrypoint.sh"] 148 | 149 | EXPOSE 6379 150 | CMD ["redis-server"] 151 | -------------------------------------------------------------------------------- /7.0/debian/docker-entrypoint.sh: -------------------------------------------------------------------------------- 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 | find . \! -user redis -exec chown redis '{}' + 13 | exec gosu redis "$0" "$@" 14 | fi 15 | 16 | # set an appropriate umask (if one isn't set already) 17 | # - https://github.com/docker-library/redis/issues/305 18 | # - https://github.com/redis/redis/blob/bb875603fb7ff3f9d19aad906bd45d7db98d9a39/utils/systemd-redis_server.service#L37 19 | um="$(umask)" 20 | if [ "$um" = '0022' ]; then 21 | umask 0077 22 | fi 23 | 24 | exec "$@" 25 | -------------------------------------------------------------------------------- /7.2/alpine/Dockerfile: -------------------------------------------------------------------------------- 1 | # 2 | # NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" 3 | # 4 | # PLEASE DO NOT EDIT IT DIRECTLY. 5 | # 6 | 7 | FROM alpine:3.21 8 | 9 | # add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added 10 | RUN set -eux; \ 11 | # alpine already has a gid 999, so we'll use the next id 12 | addgroup -S -g 1000 redis; \ 13 | adduser -S -G redis -u 999 redis 14 | 15 | # runtime dependencies 16 | RUN set -eux; \ 17 | apk add --no-cache \ 18 | # add tzdata for https://github.com/docker-library/redis/issues/138 19 | tzdata \ 20 | ; 21 | 22 | # grab gosu for easy step-down from root 23 | # https://github.com/tianon/gosu/releases 24 | ENV GOSU_VERSION 1.17 25 | RUN set -eux; \ 26 | apk add --no-cache --virtual .gosu-fetch gnupg; \ 27 | arch="$(apk --print-arch)"; \ 28 | case "$arch" in \ 29 | 'x86_64') url='https://github.com/tianon/gosu/releases/download/1.17/gosu-amd64'; sha256='bbc4136d03ab138b1ad66fa4fc051bafc6cc7ffae632b069a53657279a450de3' ;; \ 30 | 'aarch64') url='https://github.com/tianon/gosu/releases/download/1.17/gosu-arm64'; sha256='c3805a85d17f4454c23d7059bcb97e1ec1af272b90126e79ed002342de08389b' ;; \ 31 | 'armhf') url='https://github.com/tianon/gosu/releases/download/1.17/gosu-armhf'; sha256='e5866286277ff2a2159fb9196fea13e0a59d3f1091ea46ddb985160b94b6841b' ;; \ 32 | 'x86') url='https://github.com/tianon/gosu/releases/download/1.17/gosu-i386'; sha256='087dbb8fe479537e64f9c86fa49ff3b41dee1cbd28739a19aaef83dc8186b1ca' ;; \ 33 | 'ppc64le') url='https://github.com/tianon/gosu/releases/download/1.17/gosu-ppc64el'; sha256='1891acdcfa70046818ab6ed3c52b9d42fa10fbb7b340eb429c8c7849691dbd76' ;; \ 34 | 'riscv64') url='https://github.com/tianon/gosu/releases/download/1.17/gosu-riscv64'; sha256='38a6444b57adce135c42d5a3689f616fc7803ddc7a07ff6f946f2ebc67a26ba6' ;; \ 35 | 's390x') url='https://github.com/tianon/gosu/releases/download/1.17/gosu-s390x'; sha256='69873bab588192f760547ca1f75b27cfcf106e9f7403fee6fd0600bc914979d0' ;; \ 36 | 'armv7') url='https://github.com/tianon/gosu/releases/download/1.17/gosu-armhf'; sha256='e5866286277ff2a2159fb9196fea13e0a59d3f1091ea46ddb985160b94b6841b' ;; \ 37 | *) echo >&2 "error: unsupported gosu architecture: '$arch'"; exit 1 ;; \ 38 | esac; \ 39 | wget -O /usr/local/bin/gosu.asc "$url.asc"; \ 40 | wget -O /usr/local/bin/gosu "$url"; \ 41 | echo "$sha256 */usr/local/bin/gosu" | sha256sum -c -; \ 42 | export GNUPGHOME="$(mktemp -d)"; \ 43 | gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4; \ 44 | gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu; \ 45 | gpgconf --kill all; \ 46 | rm -rf "$GNUPGHOME" /usr/local/bin/gosu.asc; \ 47 | apk del --no-network .gosu-fetch; \ 48 | chmod +x /usr/local/bin/gosu; \ 49 | gosu --version; \ 50 | gosu nobody true 51 | 52 | ENV REDIS_VERSION 7.2.9 53 | ENV REDIS_DOWNLOAD_URL http://download.redis.io/releases/redis-7.2.9.tar.gz 54 | ENV REDIS_DOWNLOAD_SHA 2343cc49db3beb9d2925a44e13032805a608821a58f25bd874c84881115a20b7 55 | 56 | RUN set -eux; \ 57 | \ 58 | apk add --no-cache --virtual .build-deps \ 59 | coreutils \ 60 | dpkg-dev dpkg \ 61 | gcc \ 62 | linux-headers \ 63 | make \ 64 | musl-dev \ 65 | openssl-dev \ 66 | # install real "wget" to avoid: 67 | # + wget -O redis.tar.gz https://download.redis.io/releases/redis-x.y.z.tar.gz 68 | # Connecting to download.redis.io (45.60.121.1:80) 69 | # wget: bad header line: XxhODalH: btu; path=/; Max-Age=900 70 | wget \ 71 | ; \ 72 | \ 73 | wget -O redis.tar.gz "$REDIS_DOWNLOAD_URL"; \ 74 | echo "$REDIS_DOWNLOAD_SHA *redis.tar.gz" | sha256sum -c -; \ 75 | mkdir -p /usr/src/redis; \ 76 | tar -xzf redis.tar.gz -C /usr/src/redis --strip-components=1; \ 77 | rm redis.tar.gz; \ 78 | \ 79 | # disable Redis protected mode [1] as it is unnecessary in context of Docker 80 | # (ports are not automatically exposed when running inside Docker, but rather explicitly by specifying -p / -P) 81 | # [1]: https://github.com/redis/redis/commit/edd4d555df57dc84265fdfb4ef59a4678832f6da 82 | grep -E '^ *createBoolConfig[(]"protected-mode",.*, *1 *,.*[)],$' /usr/src/redis/src/config.c; \ 83 | sed -ri 's!^( *createBoolConfig[(]"protected-mode",.*, *)1( *,.*[)],)$!\10\2!' /usr/src/redis/src/config.c; \ 84 | grep -E '^ *createBoolConfig[(]"protected-mode",.*, *0 *,.*[)],$' /usr/src/redis/src/config.c; \ 85 | # 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" 86 | # see also https://github.com/docker-library/redis/issues/4#issuecomment-50780840 87 | # (more exactly, this makes sure the default behavior of "save on SIGTERM" stays functional by default) 88 | \ 89 | # https://github.com/jemalloc/jemalloc/issues/467 -- we need to patch the "./configure" for the bundled jemalloc to match how Debian compiles, for compatibility 90 | # (also, we do cross-builds, so we need to embed the appropriate "--build=xxx" values to that "./configure" invocation) 91 | gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ 92 | extraJemallocConfigureFlags="--build=$gnuArch"; \ 93 | # https://salsa.debian.org/debian/jemalloc/-/blob/c0a88c37a551be7d12e4863435365c9a6a51525f/debian/rules#L8-23 94 | dpkgArch="$(dpkg --print-architecture)"; \ 95 | case "${dpkgArch##*-}" in \ 96 | amd64 | i386 | x32) extraJemallocConfigureFlags="$extraJemallocConfigureFlags --with-lg-page=12" ;; \ 97 | *) extraJemallocConfigureFlags="$extraJemallocConfigureFlags --with-lg-page=16" ;; \ 98 | esac; \ 99 | extraJemallocConfigureFlags="$extraJemallocConfigureFlags --with-lg-hugepage=21"; \ 100 | grep -F 'cd jemalloc && ./configure ' /usr/src/redis/deps/Makefile; \ 101 | sed -ri 's!cd jemalloc && ./configure !&'"$extraJemallocConfigureFlags"' !' /usr/src/redis/deps/Makefile; \ 102 | grep -F "cd jemalloc && ./configure $extraJemallocConfigureFlags " /usr/src/redis/deps/Makefile; \ 103 | \ 104 | export BUILD_TLS=yes; \ 105 | make -C /usr/src/redis -j "$(nproc)" all; \ 106 | make -C /usr/src/redis install; \ 107 | \ 108 | # TODO https://github.com/redis/redis/pull/3494 (deduplicate "redis-server" copies) 109 | serverMd5="$(md5sum /usr/local/bin/redis-server | cut -d' ' -f1)"; export serverMd5; \ 110 | find /usr/local/bin/redis* -maxdepth 0 \ 111 | -type f -not -name redis-server \ 112 | -exec sh -eux -c ' \ 113 | md5="$(md5sum "$1" | cut -d" " -f1)"; \ 114 | test "$md5" = "$serverMd5"; \ 115 | ' -- '{}' ';' \ 116 | -exec ln -svfT 'redis-server' '{}' ';' \ 117 | ; \ 118 | \ 119 | rm -r /usr/src/redis; \ 120 | \ 121 | runDeps="$( \ 122 | scanelf --needed --nobanner --format '%n#p' --recursive /usr/local \ 123 | | tr ',' '\n' \ 124 | | sort -u \ 125 | | awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \ 126 | )"; \ 127 | apk add --no-network --virtual .redis-rundeps $runDeps; \ 128 | apk del --no-network .build-deps; \ 129 | \ 130 | redis-cli --version; \ 131 | redis-server --version 132 | 133 | RUN mkdir /data && chown redis:redis /data 134 | VOLUME /data 135 | WORKDIR /data 136 | 137 | COPY docker-entrypoint.sh /usr/local/bin/ 138 | ENTRYPOINT ["docker-entrypoint.sh"] 139 | 140 | EXPOSE 6379 141 | CMD ["redis-server"] 142 | -------------------------------------------------------------------------------- /7.2/alpine/docker-entrypoint.sh: -------------------------------------------------------------------------------- 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 | find . \! -user redis -exec chown redis '{}' + 13 | exec gosu redis "$0" "$@" 14 | fi 15 | 16 | # set an appropriate umask (if one isn't set already) 17 | # - https://github.com/docker-library/redis/issues/305 18 | # - https://github.com/redis/redis/blob/bb875603fb7ff3f9d19aad906bd45d7db98d9a39/utils/systemd-redis_server.service#L37 19 | um="$(umask)" 20 | if [ "$um" = '0022' ]; then 21 | umask 0077 22 | fi 23 | 24 | exec "$@" 25 | -------------------------------------------------------------------------------- /7.2/debian/Dockerfile: -------------------------------------------------------------------------------- 1 | # 2 | # NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" 3 | # 4 | # PLEASE DO NOT EDIT IT DIRECTLY. 5 | # 6 | 7 | FROM debian:bookworm-slim 8 | 9 | # add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added 10 | RUN set -eux; \ 11 | groupadd -r -g 999 redis; \ 12 | useradd -r -g redis -u 999 redis 13 | 14 | # runtime dependencies 15 | RUN set -eux; \ 16 | apt-get update; \ 17 | apt-get install -y --no-install-recommends \ 18 | # add tzdata explicitly for https://github.com/docker-library/redis/issues/138 (see also https://bugs.debian.org/837060 and related) 19 | tzdata \ 20 | ; \ 21 | rm -rf /var/lib/apt/lists/* 22 | 23 | # grab gosu for easy step-down from root 24 | # https://github.com/tianon/gosu/releases 25 | ENV GOSU_VERSION 1.17 26 | RUN set -eux; \ 27 | savedAptMark="$(apt-mark showmanual)"; \ 28 | apt-get update; \ 29 | apt-get install -y --no-install-recommends ca-certificates gnupg wget; \ 30 | rm -rf /var/lib/apt/lists/*; \ 31 | arch="$(dpkg --print-architecture | awk -F- '{ print $NF }')"; \ 32 | case "$arch" in \ 33 | 'amd64') url='https://github.com/tianon/gosu/releases/download/1.17/gosu-amd64'; sha256='bbc4136d03ab138b1ad66fa4fc051bafc6cc7ffae632b069a53657279a450de3' ;; \ 34 | 'arm64') url='https://github.com/tianon/gosu/releases/download/1.17/gosu-arm64'; sha256='c3805a85d17f4454c23d7059bcb97e1ec1af272b90126e79ed002342de08389b' ;; \ 35 | 'armel') url='https://github.com/tianon/gosu/releases/download/1.17/gosu-armel'; sha256='f9969910fa141140438c998cfa02f603bf213b11afd466dcde8fa940e700945d' ;; \ 36 | 'i386') url='https://github.com/tianon/gosu/releases/download/1.17/gosu-i386'; sha256='087dbb8fe479537e64f9c86fa49ff3b41dee1cbd28739a19aaef83dc8186b1ca' ;; \ 37 | 'mips64el') url='https://github.com/tianon/gosu/releases/download/1.17/gosu-mips64el'; sha256='87140029d792595e660be0015341dfa1c02d1181459ae40df9f093e471d75b70' ;; \ 38 | 'ppc64el') url='https://github.com/tianon/gosu/releases/download/1.17/gosu-ppc64el'; sha256='1891acdcfa70046818ab6ed3c52b9d42fa10fbb7b340eb429c8c7849691dbd76' ;; \ 39 | 'riscv64') url='https://github.com/tianon/gosu/releases/download/1.17/gosu-riscv64'; sha256='38a6444b57adce135c42d5a3689f616fc7803ddc7a07ff6f946f2ebc67a26ba6' ;; \ 40 | 's390x') url='https://github.com/tianon/gosu/releases/download/1.17/gosu-s390x'; sha256='69873bab588192f760547ca1f75b27cfcf106e9f7403fee6fd0600bc914979d0' ;; \ 41 | 'armhf') url='https://github.com/tianon/gosu/releases/download/1.17/gosu-armhf'; sha256='e5866286277ff2a2159fb9196fea13e0a59d3f1091ea46ddb985160b94b6841b' ;; \ 42 | *) echo >&2 "error: unsupported gosu architecture: '$arch'"; exit 1 ;; \ 43 | esac; \ 44 | wget -O /usr/local/bin/gosu.asc "$url.asc"; \ 45 | wget -O /usr/local/bin/gosu "$url"; \ 46 | echo "$sha256 */usr/local/bin/gosu" | sha256sum -c -; \ 47 | export GNUPGHOME="$(mktemp -d)"; \ 48 | gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4; \ 49 | gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu; \ 50 | gpgconf --kill all; \ 51 | rm -rf "$GNUPGHOME" /usr/local/bin/gosu.asc; \ 52 | apt-mark auto '.*' > /dev/null; \ 53 | [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark > /dev/null; \ 54 | apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ 55 | chmod +x /usr/local/bin/gosu; \ 56 | gosu --version; \ 57 | gosu nobody true 58 | 59 | ENV REDIS_VERSION 7.2.9 60 | ENV REDIS_DOWNLOAD_URL http://download.redis.io/releases/redis-7.2.9.tar.gz 61 | ENV REDIS_DOWNLOAD_SHA 2343cc49db3beb9d2925a44e13032805a608821a58f25bd874c84881115a20b7 62 | 63 | RUN set -eux; \ 64 | \ 65 | savedAptMark="$(apt-mark showmanual)"; \ 66 | apt-get update; \ 67 | apt-get install -y --no-install-recommends \ 68 | ca-certificates \ 69 | wget \ 70 | \ 71 | dpkg-dev \ 72 | gcc \ 73 | libc6-dev \ 74 | libssl-dev \ 75 | make \ 76 | ; \ 77 | rm -rf /var/lib/apt/lists/*; \ 78 | \ 79 | wget -O redis.tar.gz "$REDIS_DOWNLOAD_URL"; \ 80 | echo "$REDIS_DOWNLOAD_SHA *redis.tar.gz" | sha256sum -c -; \ 81 | mkdir -p /usr/src/redis; \ 82 | tar -xzf redis.tar.gz -C /usr/src/redis --strip-components=1; \ 83 | rm redis.tar.gz; \ 84 | \ 85 | # disable Redis protected mode [1] as it is unnecessary in context of Docker 86 | # (ports are not automatically exposed when running inside Docker, but rather explicitly by specifying -p / -P) 87 | # [1]: https://github.com/redis/redis/commit/edd4d555df57dc84265fdfb4ef59a4678832f6da 88 | grep -E '^ *createBoolConfig[(]"protected-mode",.*, *1 *,.*[)],$' /usr/src/redis/src/config.c; \ 89 | sed -ri 's!^( *createBoolConfig[(]"protected-mode",.*, *)1( *,.*[)],)$!\10\2!' /usr/src/redis/src/config.c; \ 90 | grep -E '^ *createBoolConfig[(]"protected-mode",.*, *0 *,.*[)],$' /usr/src/redis/src/config.c; \ 91 | # 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" 92 | # see also https://github.com/docker-library/redis/issues/4#issuecomment-50780840 93 | # (more exactly, this makes sure the default behavior of "save on SIGTERM" stays functional by default) 94 | \ 95 | # https://github.com/jemalloc/jemalloc/issues/467 -- we need to patch the "./configure" for the bundled jemalloc to match how Debian compiles, for compatibility 96 | # (also, we do cross-builds, so we need to embed the appropriate "--build=xxx" values to that "./configure" invocation) 97 | gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ 98 | extraJemallocConfigureFlags="--build=$gnuArch"; \ 99 | # https://salsa.debian.org/debian/jemalloc/-/blob/c0a88c37a551be7d12e4863435365c9a6a51525f/debian/rules#L8-23 100 | dpkgArch="$(dpkg --print-architecture)"; \ 101 | case "${dpkgArch##*-}" in \ 102 | amd64 | i386 | x32) extraJemallocConfigureFlags="$extraJemallocConfigureFlags --with-lg-page=12" ;; \ 103 | *) extraJemallocConfigureFlags="$extraJemallocConfigureFlags --with-lg-page=16" ;; \ 104 | esac; \ 105 | extraJemallocConfigureFlags="$extraJemallocConfigureFlags --with-lg-hugepage=21"; \ 106 | grep -F 'cd jemalloc && ./configure ' /usr/src/redis/deps/Makefile; \ 107 | sed -ri 's!cd jemalloc && ./configure !&'"$extraJemallocConfigureFlags"' !' /usr/src/redis/deps/Makefile; \ 108 | grep -F "cd jemalloc && ./configure $extraJemallocConfigureFlags " /usr/src/redis/deps/Makefile; \ 109 | \ 110 | export BUILD_TLS=yes; \ 111 | make -C /usr/src/redis -j "$(nproc)" all; \ 112 | make -C /usr/src/redis install; \ 113 | \ 114 | # TODO https://github.com/redis/redis/pull/3494 (deduplicate "redis-server" copies) 115 | serverMd5="$(md5sum /usr/local/bin/redis-server | cut -d' ' -f1)"; export serverMd5; \ 116 | find /usr/local/bin/redis* -maxdepth 0 \ 117 | -type f -not -name redis-server \ 118 | -exec sh -eux -c ' \ 119 | md5="$(md5sum "$1" | cut -d" " -f1)"; \ 120 | test "$md5" = "$serverMd5"; \ 121 | ' -- '{}' ';' \ 122 | -exec ln -svfT 'redis-server' '{}' ';' \ 123 | ; \ 124 | \ 125 | rm -r /usr/src/redis; \ 126 | \ 127 | apt-mark auto '.*' > /dev/null; \ 128 | [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark > /dev/null; \ 129 | find /usr/local -type f -executable -exec ldd '{}' ';' \ 130 | | awk '/=>/ { so = $(NF-1); if (index(so, "/usr/local/") == 1) { next }; gsub("^/(usr/)?", "", so); printf "*%s\n", so }' \ 131 | | sort -u \ 132 | | xargs -r dpkg-query --search \ 133 | | cut -d: -f1 \ 134 | | sort -u \ 135 | | xargs -r apt-mark manual \ 136 | ; \ 137 | apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ 138 | \ 139 | redis-cli --version; \ 140 | redis-server --version 141 | 142 | RUN mkdir /data && chown redis:redis /data 143 | VOLUME /data 144 | WORKDIR /data 145 | 146 | COPY docker-entrypoint.sh /usr/local/bin/ 147 | ENTRYPOINT ["docker-entrypoint.sh"] 148 | 149 | EXPOSE 6379 150 | CMD ["redis-server"] 151 | -------------------------------------------------------------------------------- /7.2/debian/docker-entrypoint.sh: -------------------------------------------------------------------------------- 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 | find . \! -user redis -exec chown redis '{}' + 13 | exec gosu redis "$0" "$@" 14 | fi 15 | 16 | # set an appropriate umask (if one isn't set already) 17 | # - https://github.com/docker-library/redis/issues/305 18 | # - https://github.com/redis/redis/blob/bb875603fb7ff3f9d19aad906bd45d7db98d9a39/utils/systemd-redis_server.service#L37 19 | um="$(umask)" 20 | if [ "$um" = '0022' ]; then 21 | umask 0077 22 | fi 23 | 24 | exec "$@" 25 | -------------------------------------------------------------------------------- /7.4-rc/alpine/Dockerfile: -------------------------------------------------------------------------------- 1 | # 2 | # NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" 3 | # 4 | # PLEASE DO NOT EDIT IT DIRECTLY. 5 | # 6 | 7 | FROM alpine:3.21 8 | 9 | # add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added 10 | RUN set -eux; \ 11 | # alpine already has a gid 999, so we'll use the next id 12 | addgroup -S -g 1000 redis; \ 13 | adduser -S -G redis -u 999 redis 14 | 15 | # runtime dependencies 16 | RUN set -eux; \ 17 | apk add --no-cache \ 18 | # add tzdata for https://github.com/docker-library/redis/issues/138 19 | tzdata \ 20 | ; 21 | 22 | # grab gosu for easy step-down from root 23 | # https://github.com/tianon/gosu/releases 24 | ENV GOSU_VERSION 1.17 25 | RUN set -eux; \ 26 | apk add --no-cache --virtual .gosu-fetch gnupg; \ 27 | arch="$(apk --print-arch)"; \ 28 | case "$arch" in \ 29 | 'x86_64') url='https://github.com/tianon/gosu/releases/download/1.17/gosu-amd64'; sha256='bbc4136d03ab138b1ad66fa4fc051bafc6cc7ffae632b069a53657279a450de3' ;; \ 30 | 'aarch64') url='https://github.com/tianon/gosu/releases/download/1.17/gosu-arm64'; sha256='c3805a85d17f4454c23d7059bcb97e1ec1af272b90126e79ed002342de08389b' ;; \ 31 | 'armhf') url='https://github.com/tianon/gosu/releases/download/1.17/gosu-armhf'; sha256='e5866286277ff2a2159fb9196fea13e0a59d3f1091ea46ddb985160b94b6841b' ;; \ 32 | 'x86') url='https://github.com/tianon/gosu/releases/download/1.17/gosu-i386'; sha256='087dbb8fe479537e64f9c86fa49ff3b41dee1cbd28739a19aaef83dc8186b1ca' ;; \ 33 | 'ppc64le') url='https://github.com/tianon/gosu/releases/download/1.17/gosu-ppc64el'; sha256='1891acdcfa70046818ab6ed3c52b9d42fa10fbb7b340eb429c8c7849691dbd76' ;; \ 34 | 'riscv64') url='https://github.com/tianon/gosu/releases/download/1.17/gosu-riscv64'; sha256='38a6444b57adce135c42d5a3689f616fc7803ddc7a07ff6f946f2ebc67a26ba6' ;; \ 35 | 's390x') url='https://github.com/tianon/gosu/releases/download/1.17/gosu-s390x'; sha256='69873bab588192f760547ca1f75b27cfcf106e9f7403fee6fd0600bc914979d0' ;; \ 36 | 'armv7') url='https://github.com/tianon/gosu/releases/download/1.17/gosu-armhf'; sha256='e5866286277ff2a2159fb9196fea13e0a59d3f1091ea46ddb985160b94b6841b' ;; \ 37 | *) echo >&2 "error: unsupported gosu architecture: '$arch'"; exit 1 ;; \ 38 | esac; \ 39 | wget -O /usr/local/bin/gosu.asc "$url.asc"; \ 40 | wget -O /usr/local/bin/gosu "$url"; \ 41 | echo "$sha256 */usr/local/bin/gosu" | sha256sum -c -; \ 42 | export GNUPGHOME="$(mktemp -d)"; \ 43 | gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4; \ 44 | gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu; \ 45 | gpgconf --kill all; \ 46 | rm -rf "$GNUPGHOME" /usr/local/bin/gosu.asc; \ 47 | apk del --no-network .gosu-fetch; \ 48 | chmod +x /usr/local/bin/gosu; \ 49 | gosu --version; \ 50 | gosu nobody true 51 | 52 | ENV REDIS_VERSION 7.4-rc2 53 | ENV REDIS_DOWNLOAD_URL http://download.redis.io/releases/redis-7.4-rc2.tar.gz 54 | ENV REDIS_DOWNLOAD_SHA 6f3ca6e196b5757bf51752ea9944cbc927731c771aeab661be8c2c05bd1edbce 55 | 56 | RUN set -eux; \ 57 | \ 58 | apk add --no-cache --virtual .build-deps \ 59 | coreutils \ 60 | dpkg-dev dpkg \ 61 | gcc \ 62 | linux-headers \ 63 | make \ 64 | musl-dev \ 65 | openssl-dev \ 66 | # install real "wget" to avoid: 67 | # + wget -O redis.tar.gz https://download.redis.io/releases/redis-x.y.z.tar.gz 68 | # Connecting to download.redis.io (45.60.121.1:80) 69 | # wget: bad header line: XxhODalH: btu; path=/; Max-Age=900 70 | wget \ 71 | ; \ 72 | \ 73 | wget -O redis.tar.gz "$REDIS_DOWNLOAD_URL"; \ 74 | echo "$REDIS_DOWNLOAD_SHA *redis.tar.gz" | sha256sum -c -; \ 75 | mkdir -p /usr/src/redis; \ 76 | tar -xzf redis.tar.gz -C /usr/src/redis --strip-components=1; \ 77 | rm redis.tar.gz; \ 78 | \ 79 | # disable Redis protected mode [1] as it is unnecessary in context of Docker 80 | # (ports are not automatically exposed when running inside Docker, but rather explicitly by specifying -p / -P) 81 | # [1]: https://github.com/redis/redis/commit/edd4d555df57dc84265fdfb4ef59a4678832f6da 82 | grep -E '^ *createBoolConfig[(]"protected-mode",.*, *1 *,.*[)],$' /usr/src/redis/src/config.c; \ 83 | sed -ri 's!^( *createBoolConfig[(]"protected-mode",.*, *)1( *,.*[)],)$!\10\2!' /usr/src/redis/src/config.c; \ 84 | grep -E '^ *createBoolConfig[(]"protected-mode",.*, *0 *,.*[)],$' /usr/src/redis/src/config.c; \ 85 | # 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" 86 | # see also https://github.com/docker-library/redis/issues/4#issuecomment-50780840 87 | # (more exactly, this makes sure the default behavior of "save on SIGTERM" stays functional by default) 88 | \ 89 | # https://github.com/jemalloc/jemalloc/issues/467 -- we need to patch the "./configure" for the bundled jemalloc to match how Debian compiles, for compatibility 90 | # (also, we do cross-builds, so we need to embed the appropriate "--build=xxx" values to that "./configure" invocation) 91 | gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ 92 | extraJemallocConfigureFlags="--build=$gnuArch"; \ 93 | # https://salsa.debian.org/debian/jemalloc/-/blob/c0a88c37a551be7d12e4863435365c9a6a51525f/debian/rules#L8-23 94 | dpkgArch="$(dpkg --print-architecture)"; \ 95 | case "${dpkgArch##*-}" in \ 96 | amd64 | i386 | x32) extraJemallocConfigureFlags="$extraJemallocConfigureFlags --with-lg-page=12" ;; \ 97 | *) extraJemallocConfigureFlags="$extraJemallocConfigureFlags --with-lg-page=16" ;; \ 98 | esac; \ 99 | extraJemallocConfigureFlags="$extraJemallocConfigureFlags --with-lg-hugepage=21"; \ 100 | grep -F 'cd jemalloc && ./configure ' /usr/src/redis/deps/Makefile; \ 101 | sed -ri 's!cd jemalloc && ./configure !&'"$extraJemallocConfigureFlags"' !' /usr/src/redis/deps/Makefile; \ 102 | grep -F "cd jemalloc && ./configure $extraJemallocConfigureFlags " /usr/src/redis/deps/Makefile; \ 103 | \ 104 | export BUILD_TLS=yes; \ 105 | make -C /usr/src/redis -j "$(nproc)" all; \ 106 | make -C /usr/src/redis install; \ 107 | \ 108 | # TODO https://github.com/redis/redis/pull/3494 (deduplicate "redis-server" copies) 109 | serverMd5="$(md5sum /usr/local/bin/redis-server | cut -d' ' -f1)"; export serverMd5; \ 110 | find /usr/local/bin/redis* -maxdepth 0 \ 111 | -type f -not -name redis-server \ 112 | -exec sh -eux -c ' \ 113 | md5="$(md5sum "$1" | cut -d" " -f1)"; \ 114 | test "$md5" = "$serverMd5"; \ 115 | ' -- '{}' ';' \ 116 | -exec ln -svfT 'redis-server' '{}' ';' \ 117 | ; \ 118 | \ 119 | rm -r /usr/src/redis; \ 120 | \ 121 | runDeps="$( \ 122 | scanelf --needed --nobanner --format '%n#p' --recursive /usr/local \ 123 | | tr ',' '\n' \ 124 | | sort -u \ 125 | | awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \ 126 | )"; \ 127 | apk add --no-network --virtual .redis-rundeps $runDeps; \ 128 | apk del --no-network .build-deps; \ 129 | \ 130 | redis-cli --version; \ 131 | redis-server --version 132 | 133 | RUN mkdir /data && chown redis:redis /data 134 | VOLUME /data 135 | WORKDIR /data 136 | 137 | COPY docker-entrypoint.sh /usr/local/bin/ 138 | ENTRYPOINT ["docker-entrypoint.sh"] 139 | 140 | EXPOSE 6379 141 | CMD ["redis-server"] 142 | -------------------------------------------------------------------------------- /7.4-rc/alpine/docker-entrypoint.sh: -------------------------------------------------------------------------------- 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 | find . \! -user redis -exec chown redis '{}' + 13 | exec gosu redis "$0" "$@" 14 | fi 15 | 16 | # set an appropriate umask (if one isn't set already) 17 | # - https://github.com/docker-library/redis/issues/305 18 | # - https://github.com/redis/redis/blob/bb875603fb7ff3f9d19aad906bd45d7db98d9a39/utils/systemd-redis_server.service#L37 19 | um="$(umask)" 20 | if [ "$um" = '0022' ]; then 21 | umask 0077 22 | fi 23 | 24 | exec "$@" 25 | -------------------------------------------------------------------------------- /7.4-rc/debian/Dockerfile: -------------------------------------------------------------------------------- 1 | # 2 | # NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" 3 | # 4 | # PLEASE DO NOT EDIT IT DIRECTLY. 5 | # 6 | 7 | FROM debian:bookworm-slim 8 | 9 | # add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added 10 | RUN set -eux; \ 11 | groupadd -r -g 999 redis; \ 12 | useradd -r -g redis -u 999 redis 13 | 14 | # runtime dependencies 15 | RUN set -eux; \ 16 | apt-get update; \ 17 | apt-get install -y --no-install-recommends \ 18 | # add tzdata explicitly for https://github.com/docker-library/redis/issues/138 (see also https://bugs.debian.org/837060 and related) 19 | tzdata \ 20 | ; \ 21 | rm -rf /var/lib/apt/lists/* 22 | 23 | # grab gosu for easy step-down from root 24 | # https://github.com/tianon/gosu/releases 25 | ENV GOSU_VERSION 1.17 26 | RUN set -eux; \ 27 | savedAptMark="$(apt-mark showmanual)"; \ 28 | apt-get update; \ 29 | apt-get install -y --no-install-recommends ca-certificates gnupg wget; \ 30 | rm -rf /var/lib/apt/lists/*; \ 31 | arch="$(dpkg --print-architecture | awk -F- '{ print $NF }')"; \ 32 | case "$arch" in \ 33 | 'amd64') url='https://github.com/tianon/gosu/releases/download/1.17/gosu-amd64'; sha256='bbc4136d03ab138b1ad66fa4fc051bafc6cc7ffae632b069a53657279a450de3' ;; \ 34 | 'arm64') url='https://github.com/tianon/gosu/releases/download/1.17/gosu-arm64'; sha256='c3805a85d17f4454c23d7059bcb97e1ec1af272b90126e79ed002342de08389b' ;; \ 35 | 'armel') url='https://github.com/tianon/gosu/releases/download/1.17/gosu-armel'; sha256='f9969910fa141140438c998cfa02f603bf213b11afd466dcde8fa940e700945d' ;; \ 36 | 'i386') url='https://github.com/tianon/gosu/releases/download/1.17/gosu-i386'; sha256='087dbb8fe479537e64f9c86fa49ff3b41dee1cbd28739a19aaef83dc8186b1ca' ;; \ 37 | 'mips64el') url='https://github.com/tianon/gosu/releases/download/1.17/gosu-mips64el'; sha256='87140029d792595e660be0015341dfa1c02d1181459ae40df9f093e471d75b70' ;; \ 38 | 'ppc64el') url='https://github.com/tianon/gosu/releases/download/1.17/gosu-ppc64el'; sha256='1891acdcfa70046818ab6ed3c52b9d42fa10fbb7b340eb429c8c7849691dbd76' ;; \ 39 | 'riscv64') url='https://github.com/tianon/gosu/releases/download/1.17/gosu-riscv64'; sha256='38a6444b57adce135c42d5a3689f616fc7803ddc7a07ff6f946f2ebc67a26ba6' ;; \ 40 | 's390x') url='https://github.com/tianon/gosu/releases/download/1.17/gosu-s390x'; sha256='69873bab588192f760547ca1f75b27cfcf106e9f7403fee6fd0600bc914979d0' ;; \ 41 | 'armhf') url='https://github.com/tianon/gosu/releases/download/1.17/gosu-armhf'; sha256='e5866286277ff2a2159fb9196fea13e0a59d3f1091ea46ddb985160b94b6841b' ;; \ 42 | *) echo >&2 "error: unsupported gosu architecture: '$arch'"; exit 1 ;; \ 43 | esac; \ 44 | wget -O /usr/local/bin/gosu.asc "$url.asc"; \ 45 | wget -O /usr/local/bin/gosu "$url"; \ 46 | echo "$sha256 */usr/local/bin/gosu" | sha256sum -c -; \ 47 | export GNUPGHOME="$(mktemp -d)"; \ 48 | gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4; \ 49 | gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu; \ 50 | gpgconf --kill all; \ 51 | rm -rf "$GNUPGHOME" /usr/local/bin/gosu.asc; \ 52 | apt-mark auto '.*' > /dev/null; \ 53 | [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark > /dev/null; \ 54 | apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ 55 | chmod +x /usr/local/bin/gosu; \ 56 | gosu --version; \ 57 | gosu nobody true 58 | 59 | ENV REDIS_VERSION 7.4-rc2 60 | ENV REDIS_DOWNLOAD_URL http://download.redis.io/releases/redis-7.4-rc2.tar.gz 61 | ENV REDIS_DOWNLOAD_SHA 6f3ca6e196b5757bf51752ea9944cbc927731c771aeab661be8c2c05bd1edbce 62 | 63 | RUN set -eux; \ 64 | \ 65 | savedAptMark="$(apt-mark showmanual)"; \ 66 | apt-get update; \ 67 | apt-get install -y --no-install-recommends \ 68 | ca-certificates \ 69 | wget \ 70 | \ 71 | dpkg-dev \ 72 | gcc \ 73 | libc6-dev \ 74 | libssl-dev \ 75 | make \ 76 | ; \ 77 | rm -rf /var/lib/apt/lists/*; \ 78 | \ 79 | wget -O redis.tar.gz "$REDIS_DOWNLOAD_URL"; \ 80 | echo "$REDIS_DOWNLOAD_SHA *redis.tar.gz" | sha256sum -c -; \ 81 | mkdir -p /usr/src/redis; \ 82 | tar -xzf redis.tar.gz -C /usr/src/redis --strip-components=1; \ 83 | rm redis.tar.gz; \ 84 | \ 85 | # disable Redis protected mode [1] as it is unnecessary in context of Docker 86 | # (ports are not automatically exposed when running inside Docker, but rather explicitly by specifying -p / -P) 87 | # [1]: https://github.com/redis/redis/commit/edd4d555df57dc84265fdfb4ef59a4678832f6da 88 | grep -E '^ *createBoolConfig[(]"protected-mode",.*, *1 *,.*[)],$' /usr/src/redis/src/config.c; \ 89 | sed -ri 's!^( *createBoolConfig[(]"protected-mode",.*, *)1( *,.*[)],)$!\10\2!' /usr/src/redis/src/config.c; \ 90 | grep -E '^ *createBoolConfig[(]"protected-mode",.*, *0 *,.*[)],$' /usr/src/redis/src/config.c; \ 91 | # 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" 92 | # see also https://github.com/docker-library/redis/issues/4#issuecomment-50780840 93 | # (more exactly, this makes sure the default behavior of "save on SIGTERM" stays functional by default) 94 | \ 95 | # https://github.com/jemalloc/jemalloc/issues/467 -- we need to patch the "./configure" for the bundled jemalloc to match how Debian compiles, for compatibility 96 | # (also, we do cross-builds, so we need to embed the appropriate "--build=xxx" values to that "./configure" invocation) 97 | gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ 98 | extraJemallocConfigureFlags="--build=$gnuArch"; \ 99 | # https://salsa.debian.org/debian/jemalloc/-/blob/c0a88c37a551be7d12e4863435365c9a6a51525f/debian/rules#L8-23 100 | dpkgArch="$(dpkg --print-architecture)"; \ 101 | case "${dpkgArch##*-}" in \ 102 | amd64 | i386 | x32) extraJemallocConfigureFlags="$extraJemallocConfigureFlags --with-lg-page=12" ;; \ 103 | *) extraJemallocConfigureFlags="$extraJemallocConfigureFlags --with-lg-page=16" ;; \ 104 | esac; \ 105 | extraJemallocConfigureFlags="$extraJemallocConfigureFlags --with-lg-hugepage=21"; \ 106 | grep -F 'cd jemalloc && ./configure ' /usr/src/redis/deps/Makefile; \ 107 | sed -ri 's!cd jemalloc && ./configure !&'"$extraJemallocConfigureFlags"' !' /usr/src/redis/deps/Makefile; \ 108 | grep -F "cd jemalloc && ./configure $extraJemallocConfigureFlags " /usr/src/redis/deps/Makefile; \ 109 | \ 110 | export BUILD_TLS=yes; \ 111 | make -C /usr/src/redis -j "$(nproc)" all; \ 112 | make -C /usr/src/redis install; \ 113 | \ 114 | # TODO https://github.com/redis/redis/pull/3494 (deduplicate "redis-server" copies) 115 | serverMd5="$(md5sum /usr/local/bin/redis-server | cut -d' ' -f1)"; export serverMd5; \ 116 | find /usr/local/bin/redis* -maxdepth 0 \ 117 | -type f -not -name redis-server \ 118 | -exec sh -eux -c ' \ 119 | md5="$(md5sum "$1" | cut -d" " -f1)"; \ 120 | test "$md5" = "$serverMd5"; \ 121 | ' -- '{}' ';' \ 122 | -exec ln -svfT 'redis-server' '{}' ';' \ 123 | ; \ 124 | \ 125 | rm -r /usr/src/redis; \ 126 | \ 127 | apt-mark auto '.*' > /dev/null; \ 128 | [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark > /dev/null; \ 129 | find /usr/local -type f -executable -exec ldd '{}' ';' \ 130 | | awk '/=>/ { so = $(NF-1); if (index(so, "/usr/local/") == 1) { next }; gsub("^/(usr/)?", "", so); printf "*%s\n", so }' \ 131 | | sort -u \ 132 | | xargs -r dpkg-query --search \ 133 | | cut -d: -f1 \ 134 | | sort -u \ 135 | | xargs -r apt-mark manual \ 136 | ; \ 137 | apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ 138 | \ 139 | redis-cli --version; \ 140 | redis-server --version 141 | 142 | RUN mkdir /data && chown redis:redis /data 143 | VOLUME /data 144 | WORKDIR /data 145 | 146 | COPY docker-entrypoint.sh /usr/local/bin/ 147 | ENTRYPOINT ["docker-entrypoint.sh"] 148 | 149 | EXPOSE 6379 150 | CMD ["redis-server"] 151 | -------------------------------------------------------------------------------- /7.4-rc/debian/docker-entrypoint.sh: -------------------------------------------------------------------------------- 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 | find . \! -user redis -exec chown redis '{}' + 13 | exec gosu redis "$0" "$@" 14 | fi 15 | 16 | # set an appropriate umask (if one isn't set already) 17 | # - https://github.com/docker-library/redis/issues/305 18 | # - https://github.com/redis/redis/blob/bb875603fb7ff3f9d19aad906bd45d7db98d9a39/utils/systemd-redis_server.service#L37 19 | um="$(umask)" 20 | if [ "$um" = '0022' ]; then 21 | umask 0077 22 | fi 23 | 24 | exec "$@" 25 | -------------------------------------------------------------------------------- /7.4/alpine/Dockerfile: -------------------------------------------------------------------------------- 1 | # 2 | # NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" 3 | # 4 | # PLEASE DO NOT EDIT IT DIRECTLY. 5 | # 6 | 7 | FROM alpine:3.21 8 | 9 | # add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added 10 | RUN set -eux; \ 11 | # alpine already has a gid 999, so we'll use the next id 12 | addgroup -S -g 1000 redis; \ 13 | adduser -S -G redis -u 999 redis 14 | 15 | # runtime dependencies 16 | RUN set -eux; \ 17 | apk add --no-cache \ 18 | # add tzdata for https://github.com/docker-library/redis/issues/138 19 | tzdata \ 20 | ; 21 | 22 | # grab gosu for easy step-down from root 23 | # https://github.com/tianon/gosu/releases 24 | ENV GOSU_VERSION 1.17 25 | RUN set -eux; \ 26 | apk add --no-cache --virtual .gosu-fetch gnupg; \ 27 | arch="$(apk --print-arch)"; \ 28 | case "$arch" in \ 29 | 'x86_64') url='https://github.com/tianon/gosu/releases/download/1.17/gosu-amd64'; sha256='bbc4136d03ab138b1ad66fa4fc051bafc6cc7ffae632b069a53657279a450de3' ;; \ 30 | 'aarch64') url='https://github.com/tianon/gosu/releases/download/1.17/gosu-arm64'; sha256='c3805a85d17f4454c23d7059bcb97e1ec1af272b90126e79ed002342de08389b' ;; \ 31 | 'armhf') url='https://github.com/tianon/gosu/releases/download/1.17/gosu-armhf'; sha256='e5866286277ff2a2159fb9196fea13e0a59d3f1091ea46ddb985160b94b6841b' ;; \ 32 | 'x86') url='https://github.com/tianon/gosu/releases/download/1.17/gosu-i386'; sha256='087dbb8fe479537e64f9c86fa49ff3b41dee1cbd28739a19aaef83dc8186b1ca' ;; \ 33 | 'ppc64le') url='https://github.com/tianon/gosu/releases/download/1.17/gosu-ppc64el'; sha256='1891acdcfa70046818ab6ed3c52b9d42fa10fbb7b340eb429c8c7849691dbd76' ;; \ 34 | 'riscv64') url='https://github.com/tianon/gosu/releases/download/1.17/gosu-riscv64'; sha256='38a6444b57adce135c42d5a3689f616fc7803ddc7a07ff6f946f2ebc67a26ba6' ;; \ 35 | 's390x') url='https://github.com/tianon/gosu/releases/download/1.17/gosu-s390x'; sha256='69873bab588192f760547ca1f75b27cfcf106e9f7403fee6fd0600bc914979d0' ;; \ 36 | 'armv7') url='https://github.com/tianon/gosu/releases/download/1.17/gosu-armhf'; sha256='e5866286277ff2a2159fb9196fea13e0a59d3f1091ea46ddb985160b94b6841b' ;; \ 37 | *) echo >&2 "error: unsupported gosu architecture: '$arch'"; exit 1 ;; \ 38 | esac; \ 39 | wget -O /usr/local/bin/gosu.asc "$url.asc"; \ 40 | wget -O /usr/local/bin/gosu "$url"; \ 41 | echo "$sha256 */usr/local/bin/gosu" | sha256sum -c -; \ 42 | export GNUPGHOME="$(mktemp -d)"; \ 43 | gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4; \ 44 | gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu; \ 45 | gpgconf --kill all; \ 46 | rm -rf "$GNUPGHOME" /usr/local/bin/gosu.asc; \ 47 | apk del --no-network .gosu-fetch; \ 48 | chmod +x /usr/local/bin/gosu; \ 49 | gosu --version; \ 50 | gosu nobody true 51 | 52 | ENV REDIS_VERSION 7.4.4 53 | ENV REDIS_DOWNLOAD_URL http://download.redis.io/releases/redis-7.4.4.tar.gz 54 | ENV REDIS_DOWNLOAD_SHA 985c465146453f4d79912e70b2dc516577a1667cbf9b0420a0c87878fcc6f32f 55 | 56 | RUN set -eux; \ 57 | \ 58 | apk add --no-cache --virtual .build-deps \ 59 | coreutils \ 60 | dpkg-dev dpkg \ 61 | gcc \ 62 | linux-headers \ 63 | make \ 64 | musl-dev \ 65 | openssl-dev \ 66 | # install real "wget" to avoid: 67 | # + wget -O redis.tar.gz https://download.redis.io/releases/redis-x.y.z.tar.gz 68 | # Connecting to download.redis.io (45.60.121.1:80) 69 | # wget: bad header line: XxhODalH: btu; path=/; Max-Age=900 70 | wget \ 71 | ; \ 72 | \ 73 | wget -O redis.tar.gz "$REDIS_DOWNLOAD_URL"; \ 74 | echo "$REDIS_DOWNLOAD_SHA *redis.tar.gz" | sha256sum -c -; \ 75 | mkdir -p /usr/src/redis; \ 76 | tar -xzf redis.tar.gz -C /usr/src/redis --strip-components=1; \ 77 | rm redis.tar.gz; \ 78 | \ 79 | # disable Redis protected mode [1] as it is unnecessary in context of Docker 80 | # (ports are not automatically exposed when running inside Docker, but rather explicitly by specifying -p / -P) 81 | # [1]: https://github.com/redis/redis/commit/edd4d555df57dc84265fdfb4ef59a4678832f6da 82 | grep -E '^ *createBoolConfig[(]"protected-mode",.*, *1 *,.*[)],$' /usr/src/redis/src/config.c; \ 83 | sed -ri 's!^( *createBoolConfig[(]"protected-mode",.*, *)1( *,.*[)],)$!\10\2!' /usr/src/redis/src/config.c; \ 84 | grep -E '^ *createBoolConfig[(]"protected-mode",.*, *0 *,.*[)],$' /usr/src/redis/src/config.c; \ 85 | # 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" 86 | # see also https://github.com/docker-library/redis/issues/4#issuecomment-50780840 87 | # (more exactly, this makes sure the default behavior of "save on SIGTERM" stays functional by default) 88 | \ 89 | # https://github.com/jemalloc/jemalloc/issues/467 -- we need to patch the "./configure" for the bundled jemalloc to match how Debian compiles, for compatibility 90 | # (also, we do cross-builds, so we need to embed the appropriate "--build=xxx" values to that "./configure" invocation) 91 | gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ 92 | extraJemallocConfigureFlags="--build=$gnuArch"; \ 93 | # https://salsa.debian.org/debian/jemalloc/-/blob/c0a88c37a551be7d12e4863435365c9a6a51525f/debian/rules#L8-23 94 | dpkgArch="$(dpkg --print-architecture)"; \ 95 | case "${dpkgArch##*-}" in \ 96 | amd64 | i386 | x32) extraJemallocConfigureFlags="$extraJemallocConfigureFlags --with-lg-page=12" ;; \ 97 | *) extraJemallocConfigureFlags="$extraJemallocConfigureFlags --with-lg-page=16" ;; \ 98 | esac; \ 99 | extraJemallocConfigureFlags="$extraJemallocConfigureFlags --with-lg-hugepage=21"; \ 100 | grep -F 'cd jemalloc && ./configure ' /usr/src/redis/deps/Makefile; \ 101 | sed -ri 's!cd jemalloc && ./configure !&'"$extraJemallocConfigureFlags"' !' /usr/src/redis/deps/Makefile; \ 102 | grep -F "cd jemalloc && ./configure $extraJemallocConfigureFlags " /usr/src/redis/deps/Makefile; \ 103 | \ 104 | export BUILD_TLS=yes; \ 105 | make -C /usr/src/redis -j "$(nproc)" all; \ 106 | make -C /usr/src/redis install; \ 107 | \ 108 | # TODO https://github.com/redis/redis/pull/3494 (deduplicate "redis-server" copies) 109 | serverMd5="$(md5sum /usr/local/bin/redis-server | cut -d' ' -f1)"; export serverMd5; \ 110 | find /usr/local/bin/redis* -maxdepth 0 \ 111 | -type f -not -name redis-server \ 112 | -exec sh -eux -c ' \ 113 | md5="$(md5sum "$1" | cut -d" " -f1)"; \ 114 | test "$md5" = "$serverMd5"; \ 115 | ' -- '{}' ';' \ 116 | -exec ln -svfT 'redis-server' '{}' ';' \ 117 | ; \ 118 | \ 119 | rm -r /usr/src/redis; \ 120 | \ 121 | runDeps="$( \ 122 | scanelf --needed --nobanner --format '%n#p' --recursive /usr/local \ 123 | | tr ',' '\n' \ 124 | | sort -u \ 125 | | awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \ 126 | )"; \ 127 | apk add --no-network --virtual .redis-rundeps $runDeps; \ 128 | apk del --no-network .build-deps; \ 129 | \ 130 | redis-cli --version; \ 131 | redis-server --version 132 | 133 | RUN mkdir /data && chown redis:redis /data 134 | VOLUME /data 135 | WORKDIR /data 136 | 137 | COPY docker-entrypoint.sh /usr/local/bin/ 138 | ENTRYPOINT ["docker-entrypoint.sh"] 139 | 140 | EXPOSE 6379 141 | CMD ["redis-server"] 142 | -------------------------------------------------------------------------------- /7.4/alpine/docker-entrypoint.sh: -------------------------------------------------------------------------------- 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 | find . \! -user redis -exec chown redis '{}' + 13 | exec gosu redis "$0" "$@" 14 | fi 15 | 16 | # set an appropriate umask (if one isn't set already) 17 | # - https://github.com/docker-library/redis/issues/305 18 | # - https://github.com/redis/redis/blob/bb875603fb7ff3f9d19aad906bd45d7db98d9a39/utils/systemd-redis_server.service#L37 19 | um="$(umask)" 20 | if [ "$um" = '0022' ]; then 21 | umask 0077 22 | fi 23 | 24 | exec "$@" 25 | -------------------------------------------------------------------------------- /7.4/debian/Dockerfile: -------------------------------------------------------------------------------- 1 | # 2 | # NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" 3 | # 4 | # PLEASE DO NOT EDIT IT DIRECTLY. 5 | # 6 | 7 | FROM debian:bookworm-slim 8 | 9 | # add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added 10 | RUN set -eux; \ 11 | groupadd -r -g 999 redis; \ 12 | useradd -r -g redis -u 999 redis 13 | 14 | # runtime dependencies 15 | RUN set -eux; \ 16 | apt-get update; \ 17 | apt-get install -y --no-install-recommends \ 18 | # add tzdata explicitly for https://github.com/docker-library/redis/issues/138 (see also https://bugs.debian.org/837060 and related) 19 | tzdata \ 20 | ; \ 21 | rm -rf /var/lib/apt/lists/* 22 | 23 | # grab gosu for easy step-down from root 24 | # https://github.com/tianon/gosu/releases 25 | ENV GOSU_VERSION 1.17 26 | RUN set -eux; \ 27 | savedAptMark="$(apt-mark showmanual)"; \ 28 | apt-get update; \ 29 | apt-get install -y --no-install-recommends ca-certificates gnupg wget; \ 30 | rm -rf /var/lib/apt/lists/*; \ 31 | arch="$(dpkg --print-architecture | awk -F- '{ print $NF }')"; \ 32 | case "$arch" in \ 33 | 'amd64') url='https://github.com/tianon/gosu/releases/download/1.17/gosu-amd64'; sha256='bbc4136d03ab138b1ad66fa4fc051bafc6cc7ffae632b069a53657279a450de3' ;; \ 34 | 'arm64') url='https://github.com/tianon/gosu/releases/download/1.17/gosu-arm64'; sha256='c3805a85d17f4454c23d7059bcb97e1ec1af272b90126e79ed002342de08389b' ;; \ 35 | 'armel') url='https://github.com/tianon/gosu/releases/download/1.17/gosu-armel'; sha256='f9969910fa141140438c998cfa02f603bf213b11afd466dcde8fa940e700945d' ;; \ 36 | 'i386') url='https://github.com/tianon/gosu/releases/download/1.17/gosu-i386'; sha256='087dbb8fe479537e64f9c86fa49ff3b41dee1cbd28739a19aaef83dc8186b1ca' ;; \ 37 | 'mips64el') url='https://github.com/tianon/gosu/releases/download/1.17/gosu-mips64el'; sha256='87140029d792595e660be0015341dfa1c02d1181459ae40df9f093e471d75b70' ;; \ 38 | 'ppc64el') url='https://github.com/tianon/gosu/releases/download/1.17/gosu-ppc64el'; sha256='1891acdcfa70046818ab6ed3c52b9d42fa10fbb7b340eb429c8c7849691dbd76' ;; \ 39 | 'riscv64') url='https://github.com/tianon/gosu/releases/download/1.17/gosu-riscv64'; sha256='38a6444b57adce135c42d5a3689f616fc7803ddc7a07ff6f946f2ebc67a26ba6' ;; \ 40 | 's390x') url='https://github.com/tianon/gosu/releases/download/1.17/gosu-s390x'; sha256='69873bab588192f760547ca1f75b27cfcf106e9f7403fee6fd0600bc914979d0' ;; \ 41 | 'armhf') url='https://github.com/tianon/gosu/releases/download/1.17/gosu-armhf'; sha256='e5866286277ff2a2159fb9196fea13e0a59d3f1091ea46ddb985160b94b6841b' ;; \ 42 | *) echo >&2 "error: unsupported gosu architecture: '$arch'"; exit 1 ;; \ 43 | esac; \ 44 | wget -O /usr/local/bin/gosu.asc "$url.asc"; \ 45 | wget -O /usr/local/bin/gosu "$url"; \ 46 | echo "$sha256 */usr/local/bin/gosu" | sha256sum -c -; \ 47 | export GNUPGHOME="$(mktemp -d)"; \ 48 | gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4; \ 49 | gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu; \ 50 | gpgconf --kill all; \ 51 | rm -rf "$GNUPGHOME" /usr/local/bin/gosu.asc; \ 52 | apt-mark auto '.*' > /dev/null; \ 53 | [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark > /dev/null; \ 54 | apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ 55 | chmod +x /usr/local/bin/gosu; \ 56 | gosu --version; \ 57 | gosu nobody true 58 | 59 | ENV REDIS_VERSION 7.4.4 60 | ENV REDIS_DOWNLOAD_URL http://download.redis.io/releases/redis-7.4.4.tar.gz 61 | ENV REDIS_DOWNLOAD_SHA 985c465146453f4d79912e70b2dc516577a1667cbf9b0420a0c87878fcc6f32f 62 | 63 | RUN set -eux; \ 64 | \ 65 | savedAptMark="$(apt-mark showmanual)"; \ 66 | apt-get update; \ 67 | apt-get install -y --no-install-recommends \ 68 | ca-certificates \ 69 | wget \ 70 | \ 71 | dpkg-dev \ 72 | gcc \ 73 | libc6-dev \ 74 | libssl-dev \ 75 | make \ 76 | ; \ 77 | rm -rf /var/lib/apt/lists/*; \ 78 | \ 79 | wget -O redis.tar.gz "$REDIS_DOWNLOAD_URL"; \ 80 | echo "$REDIS_DOWNLOAD_SHA *redis.tar.gz" | sha256sum -c -; \ 81 | mkdir -p /usr/src/redis; \ 82 | tar -xzf redis.tar.gz -C /usr/src/redis --strip-components=1; \ 83 | rm redis.tar.gz; \ 84 | \ 85 | # disable Redis protected mode [1] as it is unnecessary in context of Docker 86 | # (ports are not automatically exposed when running inside Docker, but rather explicitly by specifying -p / -P) 87 | # [1]: https://github.com/redis/redis/commit/edd4d555df57dc84265fdfb4ef59a4678832f6da 88 | grep -E '^ *createBoolConfig[(]"protected-mode",.*, *1 *,.*[)],$' /usr/src/redis/src/config.c; \ 89 | sed -ri 's!^( *createBoolConfig[(]"protected-mode",.*, *)1( *,.*[)],)$!\10\2!' /usr/src/redis/src/config.c; \ 90 | grep -E '^ *createBoolConfig[(]"protected-mode",.*, *0 *,.*[)],$' /usr/src/redis/src/config.c; \ 91 | # 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" 92 | # see also https://github.com/docker-library/redis/issues/4#issuecomment-50780840 93 | # (more exactly, this makes sure the default behavior of "save on SIGTERM" stays functional by default) 94 | \ 95 | # https://github.com/jemalloc/jemalloc/issues/467 -- we need to patch the "./configure" for the bundled jemalloc to match how Debian compiles, for compatibility 96 | # (also, we do cross-builds, so we need to embed the appropriate "--build=xxx" values to that "./configure" invocation) 97 | gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ 98 | extraJemallocConfigureFlags="--build=$gnuArch"; \ 99 | # https://salsa.debian.org/debian/jemalloc/-/blob/c0a88c37a551be7d12e4863435365c9a6a51525f/debian/rules#L8-23 100 | dpkgArch="$(dpkg --print-architecture)"; \ 101 | case "${dpkgArch##*-}" in \ 102 | amd64 | i386 | x32) extraJemallocConfigureFlags="$extraJemallocConfigureFlags --with-lg-page=12" ;; \ 103 | *) extraJemallocConfigureFlags="$extraJemallocConfigureFlags --with-lg-page=16" ;; \ 104 | esac; \ 105 | extraJemallocConfigureFlags="$extraJemallocConfigureFlags --with-lg-hugepage=21"; \ 106 | grep -F 'cd jemalloc && ./configure ' /usr/src/redis/deps/Makefile; \ 107 | sed -ri 's!cd jemalloc && ./configure !&'"$extraJemallocConfigureFlags"' !' /usr/src/redis/deps/Makefile; \ 108 | grep -F "cd jemalloc && ./configure $extraJemallocConfigureFlags " /usr/src/redis/deps/Makefile; \ 109 | \ 110 | export BUILD_TLS=yes; \ 111 | make -C /usr/src/redis -j "$(nproc)" all; \ 112 | make -C /usr/src/redis install; \ 113 | \ 114 | # TODO https://github.com/redis/redis/pull/3494 (deduplicate "redis-server" copies) 115 | serverMd5="$(md5sum /usr/local/bin/redis-server | cut -d' ' -f1)"; export serverMd5; \ 116 | find /usr/local/bin/redis* -maxdepth 0 \ 117 | -type f -not -name redis-server \ 118 | -exec sh -eux -c ' \ 119 | md5="$(md5sum "$1" | cut -d" " -f1)"; \ 120 | test "$md5" = "$serverMd5"; \ 121 | ' -- '{}' ';' \ 122 | -exec ln -svfT 'redis-server' '{}' ';' \ 123 | ; \ 124 | \ 125 | rm -r /usr/src/redis; \ 126 | \ 127 | apt-mark auto '.*' > /dev/null; \ 128 | [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark > /dev/null; \ 129 | find /usr/local -type f -executable -exec ldd '{}' ';' \ 130 | | awk '/=>/ { so = $(NF-1); if (index(so, "/usr/local/") == 1) { next }; gsub("^/(usr/)?", "", so); printf "*%s\n", so }' \ 131 | | sort -u \ 132 | | xargs -r dpkg-query --search \ 133 | | cut -d: -f1 \ 134 | | sort -u \ 135 | | xargs -r apt-mark manual \ 136 | ; \ 137 | apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ 138 | \ 139 | redis-cli --version; \ 140 | redis-server --version 141 | 142 | RUN mkdir /data && chown redis:redis /data 143 | VOLUME /data 144 | WORKDIR /data 145 | 146 | COPY docker-entrypoint.sh /usr/local/bin/ 147 | ENTRYPOINT ["docker-entrypoint.sh"] 148 | 149 | EXPOSE 6379 150 | CMD ["redis-server"] 151 | -------------------------------------------------------------------------------- /7.4/debian/docker-entrypoint.sh: -------------------------------------------------------------------------------- 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 | find . \! -user redis -exec chown redis '{}' + 13 | exec gosu redis "$0" "$@" 14 | fi 15 | 16 | # set an appropriate umask (if one isn't set already) 17 | # - https://github.com/docker-library/redis/issues/305 18 | # - https://github.com/redis/redis/blob/bb875603fb7ff3f9d19aad906bd45d7db98d9a39/utils/systemd-redis_server.service#L37 19 | um="$(umask)" 20 | if [ "$um" = '0022' ]; then 21 | umask 0077 22 | fi 23 | 24 | exec "$@" 25 | -------------------------------------------------------------------------------- /BUILD.md: -------------------------------------------------------------------------------- 1 | # How the official Redis images are built 2 | 3 | ## Prepare the Docker files and metadata 4 | 5 | The general process seems to involve the following steps: 6 | 7 | 0. Install command-line tools that are reported as being `not found`. I had to install `wget`, `jq`, and `bashbrew`. 8 | 1. Regenerate the `versions.json` file with the help of the `versions.sh`. This should fetch the latest Redis version from https://raw.githubusercontent.com/redis/redis-hashes/master/README and add it to the `version.json` file. If the version isn't picked up, you can also manually edit the `versions.json` file. 9 | 2. Apply the template on the versions via `apply-templates.sh`. This should create you a new version folder that's named by the `major.minor` Redis version number. This folder contains the `Dockerfile`. 10 | 3. Execute `generate-stackbrew-library.sh`. The script automates the generation of metadata for Redis Docker images, including tags, architectures, git commit hashes, and directories based on the versions.json file. It ensures that the metadata is up-to-date with the latest commits and correctly reflects the supported architectures and versions. 11 | 12 | ## Test the build locally 13 | 14 | 1. Change the directory to the recently added version and the target base image flavor, e.g., `cd ./7.4/debian`. 15 | 2. Build the image via `docker build`, e.g., `docker build -t redis-test:7.4-rc1 .`. 16 | 3. Run the image the same way as the official docker image: `docker run --name test-7-4-rc1 -d redis-test:7.4-rc1`. 17 | 4. Open a `redis-cli` on the container `docker exec -it test-7-4-rc1 redis-cli`. -------------------------------------------------------------------------------- /Dockerfile.template: -------------------------------------------------------------------------------- 1 | {{ if env.variant == "alpine" then ( -}} 2 | FROM alpine:{{ .alpine.version }} 3 | {{ ) else ( -}} 4 | FROM debian:{{ .debian.version }}-slim 5 | {{ ) end -}} 6 | 7 | # add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added 8 | {{ if env.variant == "alpine" then ( -}} 9 | RUN set -eux; \ 10 | # alpine already has a gid 999, so we'll use the next id 11 | addgroup -S -g 1000 redis; \ 12 | adduser -S -G redis -u 999 redis 13 | {{ ) else ( -}} 14 | RUN set -eux; \ 15 | groupadd -r -g 999 redis; \ 16 | useradd -r -g redis -u 999 redis 17 | {{ ) end -}} 18 | 19 | # runtime dependencies 20 | {{ if env.variant == "alpine" then ( -}} 21 | RUN set -eux; \ 22 | apk add --no-cache \ 23 | # add tzdata for https://github.com/docker-library/redis/issues/138 24 | tzdata \ 25 | ; 26 | {{ ) else ( -}} 27 | RUN set -eux; \ 28 | apt-get update; \ 29 | apt-get install -y --no-install-recommends \ 30 | # add tzdata explicitly for https://github.com/docker-library/redis/issues/138 (see also https://bugs.debian.org/837060 and related) 31 | tzdata \ 32 | ; \ 33 | rm -rf /var/lib/apt/lists/* 34 | {{ ) end -}} 35 | 36 | # grab gosu for easy step-down from root 37 | # https://github.com/tianon/gosu/releases 38 | ENV GOSU_VERSION {{ .gosu.version }} 39 | RUN set -eux; \ 40 | {{ if env.variant == "alpine" then ( -}} 41 | apk add --no-cache --virtual .gosu-fetch gnupg; \ 42 | arch="$(apk --print-arch)"; \ 43 | {{ ) else ( -}} 44 | savedAptMark="$(apt-mark showmanual)"; \ 45 | apt-get update; \ 46 | apt-get install -y --no-install-recommends ca-certificates gnupg wget; \ 47 | rm -rf /var/lib/apt/lists/*; \ 48 | arch="$(dpkg --print-architecture | awk -F- '{ print $NF }')"; \ 49 | {{ ) end -}} 50 | case "$arch" in \ 51 | {{ 52 | [ 53 | .gosu.arches 54 | | to_entries[] 55 | | ( 56 | if env.variant == "alpine" then 57 | { 58 | # https://dl-cdn.alpinelinux.org/alpine/edge/main/ 59 | # https://dl-cdn.alpinelinux.org/alpine/latest-stable/main/ 60 | amd64: "x86_64", 61 | arm32v6: "armhf", 62 | arm32v7: "armv7", 63 | arm64v8: "aarch64", 64 | i386: "x86", 65 | ppc64le: "ppc64le", 66 | riscv64: "riscv64", 67 | s390x: "s390x", 68 | } 69 | else 70 | { 71 | # https://salsa.debian.org/dpkg-team/dpkg/-/blob/main/data/cputable 72 | # https://wiki.debian.org/ArchitectureSpecificsMemo#Architecture_baselines 73 | # http://deb.debian.org/debian/dists/unstable/main/ 74 | # http://deb.debian.org/debian/dists/stable/main/ 75 | # https://deb.debian.org/debian-ports/dists/unstable/main/ 76 | amd64: "amd64", 77 | arm32v5: "armel", 78 | arm32v7: "armhf", 79 | arm64v8: "arm64", 80 | i386: "i386", 81 | mips64le: "mips64el", 82 | ppc64le: "ppc64el", 83 | riscv64: "riscv64", 84 | s390x: "s390x", 85 | } 86 | end 87 | )[.key] as $arch 88 | | select($arch) 89 | | .value 90 | | ( 91 | -}} 92 | {{ $arch | @sh }}) url={{ .url | @sh }}; sha256={{ .sha256 | @sh }} ;; \ 93 | {{ 94 | ) 95 | ] | add 96 | -}} 97 | *) echo >&2 "error: unsupported gosu architecture: '$arch'"; exit 1 ;; \ 98 | esac; \ 99 | wget -O /usr/local/bin/gosu.asc "$url.asc"; \ 100 | wget -O /usr/local/bin/gosu "$url"; \ 101 | echo "$sha256 */usr/local/bin/gosu" | sha256sum -c -; \ 102 | export GNUPGHOME="$(mktemp -d)"; \ 103 | gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4; \ 104 | gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu; \ 105 | gpgconf --kill all; \ 106 | rm -rf "$GNUPGHOME" /usr/local/bin/gosu.asc; \ 107 | {{ if env.variant == "alpine" then ( -}} 108 | apk del --no-network .gosu-fetch; \ 109 | {{ ) else ( -}} 110 | apt-mark auto '.*' > /dev/null; \ 111 | [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark > /dev/null; \ 112 | apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ 113 | {{ ) end -}} 114 | chmod +x /usr/local/bin/gosu; \ 115 | gosu --version; \ 116 | gosu nobody true 117 | 118 | ENV REDIS_VERSION {{ .version }} 119 | ENV REDIS_DOWNLOAD_URL {{ .url }} 120 | ENV REDIS_DOWNLOAD_SHA {{ .sha256 // error("no sha256 for \(.version) (\(env.version))") }} 121 | 122 | RUN set -eux; \ 123 | \ 124 | {{ if env.variant == "alpine" then ( -}} 125 | apk add --no-cache --virtual .build-deps \ 126 | coreutils \ 127 | dpkg-dev dpkg \ 128 | gcc \ 129 | linux-headers \ 130 | make \ 131 | musl-dev \ 132 | openssl-dev \ 133 | # install real "wget" to avoid: 134 | # + wget -O redis.tar.gz https://download.redis.io/releases/redis-x.y.z.tar.gz 135 | # Connecting to download.redis.io (45.60.121.1:80) 136 | # wget: bad header line: XxhODalH: btu; path=/; Max-Age=900 137 | wget \ 138 | ; \ 139 | {{ ) else ( -}} 140 | savedAptMark="$(apt-mark showmanual)"; \ 141 | apt-get update; \ 142 | apt-get install -y --no-install-recommends \ 143 | ca-certificates \ 144 | wget \ 145 | \ 146 | dpkg-dev \ 147 | gcc \ 148 | libc6-dev \ 149 | libssl-dev \ 150 | make \ 151 | ; \ 152 | rm -rf /var/lib/apt/lists/*; \ 153 | {{ ) end -}} 154 | \ 155 | wget -O redis.tar.gz "$REDIS_DOWNLOAD_URL"; \ 156 | echo "$REDIS_DOWNLOAD_SHA *redis.tar.gz" | sha256sum -c -; \ 157 | mkdir -p /usr/src/redis; \ 158 | tar -xzf redis.tar.gz -C /usr/src/redis --strip-components=1; \ 159 | rm redis.tar.gz; \ 160 | \ 161 | # disable Redis protected mode [1] as it is unnecessary in context of Docker 162 | # (ports are not automatically exposed when running inside Docker, but rather explicitly by specifying -p / -P) 163 | # [1]: https://github.com/redis/redis/commit/edd4d555df57dc84265fdfb4ef59a4678832f6da 164 | grep -E '^ *createBoolConfig[(]"protected-mode",.*, *1 *,.*[)],$' /usr/src/redis/src/config.c; \ 165 | sed -ri 's!^( *createBoolConfig[(]"protected-mode",.*, *)1( *,.*[)],)$!\10\2!' /usr/src/redis/src/config.c; \ 166 | grep -E '^ *createBoolConfig[(]"protected-mode",.*, *0 *,.*[)],$' /usr/src/redis/src/config.c; \ 167 | # 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" 168 | # see also https://github.com/docker-library/redis/issues/4#issuecomment-50780840 169 | # (more exactly, this makes sure the default behavior of "save on SIGTERM" stays functional by default) 170 | \ 171 | # https://github.com/jemalloc/jemalloc/issues/467 -- we need to patch the "./configure" for the bundled jemalloc to match how Debian compiles, for compatibility 172 | # (also, we do cross-builds, so we need to embed the appropriate "--build=xxx" values to that "./configure" invocation) 173 | gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ 174 | extraJemallocConfigureFlags="--build=$gnuArch"; \ 175 | # https://salsa.debian.org/debian/jemalloc/-/blob/c0a88c37a551be7d12e4863435365c9a6a51525f/debian/rules#L8-23 176 | dpkgArch="$(dpkg --print-architecture)"; \ 177 | case "${dpkgArch##*-}" in \ 178 | amd64 | i386 | x32) extraJemallocConfigureFlags="$extraJemallocConfigureFlags --with-lg-page=12" ;; \ 179 | *) extraJemallocConfigureFlags="$extraJemallocConfigureFlags --with-lg-page=16" ;; \ 180 | esac; \ 181 | extraJemallocConfigureFlags="$extraJemallocConfigureFlags --with-lg-hugepage=21"; \ 182 | grep -F 'cd jemalloc && ./configure ' /usr/src/redis/deps/Makefile; \ 183 | sed -ri 's!cd jemalloc && ./configure !&'"$extraJemallocConfigureFlags"' !' /usr/src/redis/deps/Makefile; \ 184 | grep -F "cd jemalloc && ./configure $extraJemallocConfigureFlags " /usr/src/redis/deps/Makefile; \ 185 | \ 186 | export BUILD_TLS=yes; \ 187 | make -C /usr/src/redis -j "$(nproc)" all; \ 188 | make -C /usr/src/redis install; \ 189 | \ 190 | # TODO https://github.com/redis/redis/pull/3494 (deduplicate "redis-server" copies) 191 | serverMd5="$(md5sum /usr/local/bin/redis-server | cut -d' ' -f1)"; export serverMd5; \ 192 | find /usr/local/bin/redis* -maxdepth 0 \ 193 | -type f -not -name redis-server \ 194 | -exec sh -eux -c ' \ 195 | md5="$(md5sum "$1" | cut -d" " -f1)"; \ 196 | test "$md5" = "$serverMd5"; \ 197 | ' -- '{}' ';' \ 198 | -exec ln -svfT 'redis-server' '{}' ';' \ 199 | ; \ 200 | \ 201 | rm -r /usr/src/redis; \ 202 | \ 203 | {{ if env.variant == "alpine" then ( -}} 204 | runDeps="$( \ 205 | scanelf --needed --nobanner --format '%n#p' --recursive /usr/local \ 206 | | tr ',' '\n' \ 207 | | sort -u \ 208 | | awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \ 209 | )"; \ 210 | apk add --no-network --virtual .redis-rundeps $runDeps; \ 211 | apk del --no-network .build-deps; \ 212 | {{ ) else ( -}} 213 | apt-mark auto '.*' > /dev/null; \ 214 | [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark > /dev/null; \ 215 | find /usr/local -type f -executable -exec ldd '{}' ';' \ 216 | | awk '/=>/ { so = $(NF-1); if (index(so, "/usr/local/") == 1) { next }; gsub("^/(usr/)?", "", so); printf "*%s\n", so }' \ 217 | | sort -u \ 218 | | xargs -r dpkg-query --search \ 219 | | cut -d: -f1 \ 220 | | sort -u \ 221 | | xargs -r apt-mark manual \ 222 | ; \ 223 | apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ 224 | {{ ) end -}} 225 | \ 226 | redis-cli --version; \ 227 | redis-server --version 228 | 229 | RUN mkdir /data && chown redis:redis /data 230 | VOLUME /data 231 | WORKDIR /data 232 | 233 | COPY docker-entrypoint.sh /usr/local/bin/ 234 | ENTRYPOINT ["docker-entrypoint.sh"] 235 | 236 | EXPOSE 6379 237 | CMD ["redis-server"] 238 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2014 Docker, Inc. 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are 6 | met: 7 | 8 | * Redistributions of source code must retain the above copyright 9 | notice, this list of conditions and the following disclaimer. 10 | 11 | * Redistributions in binary form must reproduce the above 12 | copyright notice, this list of conditions and the following 13 | disclaimer in the documentation and/or other materials provided 14 | with the distribution. 15 | 16 | * Neither the name of Docker, Inc. nor the names of its 17 | contributors may be used to endorse or promote products derived 18 | from this software without specific prior written permission. 19 | 20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 24 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 25 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 26 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 30 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # https://github.com/docker-library/redis 2 | 3 | ## Maintained by: [the Docker Community](https://github.com/docker-library/redis) 4 | 5 | This is the Git repo of the [Docker "Official Image"](https://github.com/docker-library/official-images#what-are-official-images) for [`redis`](https://hub.docker.com/_/redis/) (not to be confused with any official `redis` image provided by `redis` upstream). See [the Docker Hub page](https://hub.docker.com/_/redis/) for the full readme on how to use this Docker image and for information regarding contributing and issues. 6 | 7 | The [full image description on Docker Hub](https://hub.docker.com/_/redis/) is generated/maintained over in [the docker-library/docs repository](https://github.com/docker-library/docs), specifically in [the `redis` directory](https://github.com/docker-library/docs/tree/master/redis). 8 | 9 | ## See a change merged here that doesn't show up on Docker Hub yet? 10 | 11 | For more information about the full official images change lifecycle, see [the "An image's source changed in Git, now what?" FAQ entry](https://github.com/docker-library/faq#an-images-source-changed-in-git-now-what). 12 | 13 | For outstanding `redis` image PRs, check [PRs with the "library/redis" label on the official-images repository](https://github.com/docker-library/official-images/labels/library%2Fredis). For the current "source of truth" for [`redis`](https://hub.docker.com/_/redis/), see [the `library/redis` file in the official-images repository](https://github.com/docker-library/official-images/blob/master/library/redis). 14 | 15 | --- 16 | 17 | - [![build status badge](https://img.shields.io/github/actions/workflow/status/docker-library/redis/ci.yml?branch=master&label=GitHub%20CI)](https://github.com/docker-library/redis/actions?query=workflow%3A%22GitHub+CI%22+branch%3Amaster) 18 | - [![build status badge](https://img.shields.io/jenkins/s/https/doi-janky.infosiftr.net/job/update.sh/job/redis.svg?label=Automated%20update.sh)](https://doi-janky.infosiftr.net/job/update.sh/job/redis/) 19 | 20 | | Build | Status | Badges | (per-arch) | 21 | |:-:|:-:|:-:|:-:| 22 | | [![amd64 build status badge](https://img.shields.io/jenkins/s/https/doi-janky.infosiftr.net/job/multiarch/job/amd64/job/redis.svg?label=amd64)](https://doi-janky.infosiftr.net/job/multiarch/job/amd64/job/redis/) | [![arm32v5 build status badge](https://img.shields.io/jenkins/s/https/doi-janky.infosiftr.net/job/multiarch/job/arm32v5/job/redis.svg?label=arm32v5)](https://doi-janky.infosiftr.net/job/multiarch/job/arm32v5/job/redis/) | [![arm32v6 build status badge](https://img.shields.io/jenkins/s/https/doi-janky.infosiftr.net/job/multiarch/job/arm32v6/job/redis.svg?label=arm32v6)](https://doi-janky.infosiftr.net/job/multiarch/job/arm32v6/job/redis/) | [![arm32v7 build status badge](https://img.shields.io/jenkins/s/https/doi-janky.infosiftr.net/job/multiarch/job/arm32v7/job/redis.svg?label=arm32v7)](https://doi-janky.infosiftr.net/job/multiarch/job/arm32v7/job/redis/) | 23 | | [![arm64v8 build status badge](https://img.shields.io/jenkins/s/https/doi-janky.infosiftr.net/job/multiarch/job/arm64v8/job/redis.svg?label=arm64v8)](https://doi-janky.infosiftr.net/job/multiarch/job/arm64v8/job/redis/) | [![i386 build status badge](https://img.shields.io/jenkins/s/https/doi-janky.infosiftr.net/job/multiarch/job/i386/job/redis.svg?label=i386)](https://doi-janky.infosiftr.net/job/multiarch/job/i386/job/redis/) | [![mips64le build status badge](https://img.shields.io/jenkins/s/https/doi-janky.infosiftr.net/job/multiarch/job/mips64le/job/redis.svg?label=mips64le)](https://doi-janky.infosiftr.net/job/multiarch/job/mips64le/job/redis/) | [![ppc64le build status badge](https://img.shields.io/jenkins/s/https/doi-janky.infosiftr.net/job/multiarch/job/ppc64le/job/redis.svg?label=ppc64le)](https://doi-janky.infosiftr.net/job/multiarch/job/ppc64le/job/redis/) | 24 | | [![s390x build status badge](https://img.shields.io/jenkins/s/https/doi-janky.infosiftr.net/job/multiarch/job/s390x/job/redis.svg?label=s390x)](https://doi-janky.infosiftr.net/job/multiarch/job/s390x/job/redis/) | [![put-shared build status badge](https://img.shields.io/jenkins/s/https/doi-janky.infosiftr.net/job/put-shared/job/light/job/redis.svg?label=put-shared)](https://doi-janky.infosiftr.net/job/put-shared/job/light/job/redis/) | 25 | 26 | 27 | -------------------------------------------------------------------------------- /apply-templates.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -Eeuo pipefail 3 | 4 | [ -f versions.json ] # run "versions.sh" first 5 | 6 | jqt='.jq-template.awk' 7 | if [ -n "${BASHBREW_SCRIPTS:-}" ]; then 8 | jqt="$BASHBREW_SCRIPTS/jq-template.awk" 9 | elif [ "$BASH_SOURCE" -nt "$jqt" ]; then 10 | # https://github.com/docker-library/bashbrew/blob/master/scripts/jq-template.awk 11 | wget -qO "$jqt" 'https://github.com/docker-library/bashbrew/raw/9f6a35772ac863a0241f147c820354e4008edf38/scripts/jq-template.awk' 12 | fi 13 | 14 | if [ "$#" -eq 0 ]; then 15 | versions="$(jq -r 'keys | map(@sh) | join(" ")' versions.json)" 16 | eval "set -- $versions" 17 | fi 18 | 19 | generated_warning() { 20 | cat <<-EOH 21 | # 22 | # NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" 23 | # 24 | # PLEASE DO NOT EDIT IT DIRECTLY. 25 | # 26 | 27 | EOH 28 | } 29 | 30 | for version; do 31 | rm -rf "$version" 32 | 33 | for variant in debian alpine; do 34 | export version variant 35 | 36 | dir="$version/$variant" 37 | 38 | echo "processing $dir ..." 39 | 40 | mkdir -p "$dir" 41 | 42 | { 43 | generated_warning 44 | gawk -f "$jqt" Dockerfile.template 45 | } > "$dir/Dockerfile" 46 | 47 | cp -a docker-entrypoint.sh "$dir/" 48 | done 49 | done 50 | -------------------------------------------------------------------------------- /docker-entrypoint.sh: -------------------------------------------------------------------------------- 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 | find . \! -user redis -exec chown redis '{}' + 13 | exec gosu redis "$0" "$@" 14 | fi 15 | 16 | # set an appropriate umask (if one isn't set already) 17 | # - https://github.com/docker-library/redis/issues/305 18 | # - https://github.com/redis/redis/blob/bb875603fb7ff3f9d19aad906bd45d7db98d9a39/utils/systemd-redis_server.service#L37 19 | um="$(umask)" 20 | if [ "$um" = '0022' ]; then 21 | umask 0077 22 | fi 23 | 24 | exec "$@" 25 | -------------------------------------------------------------------------------- /generate-stackbrew-library-mac.sh: -------------------------------------------------------------------------------- 1 | #!/opt/homebrew/bin/bash 2 | 3 | ## You need to perform the following steps before executing this script: 4 | ## 1. Install a newer version of bash: `brew install bash`. 5 | ## 2. Install additional packages: `brew install coreutils gawk`. 6 | ## 3. Ensure that you have `bashbrew` built and in your PATH. 7 | 8 | set -Eeuo pipefail 9 | 10 | declare -A aliases=( 11 | [7.4]='7 latest' 12 | [6.2]='6' 13 | ) 14 | 15 | self="$(basename "$0")" 16 | cd "$(dirname "$(greadlink -f "$0")")" 17 | 18 | if [ "$#" -eq 0 ]; then 19 | versions="$(jq -r 'keys | map(@sh) | join(" ")' versions.json)" 20 | eval "set -- $versions" 21 | fi 22 | 23 | # sort version numbers with highest first 24 | IFS=$'\n'; set -- $(sort -rV <<<"$*"); unset IFS 25 | 26 | # get the most recent commit which modified any of "$@" 27 | fileCommit() { 28 | git log -1 --format='format:%H' HEAD -- "$@" 29 | } 30 | 31 | # get the most recent commit which modified "$1/Dockerfile" or any file COPY'd from "$1/Dockerfile" 32 | dirCommit() { 33 | local dir="$1"; shift 34 | ( 35 | cd "$dir" 36 | fileCommit \ 37 | Dockerfile \ 38 | $(git show HEAD:./Dockerfile | gawk ' 39 | toupper($1) == "COPY" { 40 | for (i = 2; i < NF; i++) { 41 | print $i 42 | } 43 | } 44 | ') 45 | ) 46 | } 47 | 48 | getArches() { 49 | local repo="$1"; shift 50 | local officialImagesUrl='https://github.com/docker-library/official-images/raw/master/library/' 51 | 52 | eval "declare -g -A parentRepoToArches=( $( 53 | find . -name 'Dockerfile' -exec gawk ' 54 | toupper($1) == "FROM" && $2 !~ /^('"$repo"'|scratch|.*\/.*)(:|$)/ { 55 | print "'"$officialImagesUrl"'" $2 56 | } 57 | ' '{}' + \ 58 | | sort -u \ 59 | | xargs bashbrew cat --format '[{{ .RepoName }}:{{ .TagName }}]="{{ join " " .TagEntry.Architectures }}"' 60 | ) )" 61 | } 62 | getArches 'redis' 63 | 64 | cat <<-EOH 65 | # This file was generated via https://github.com/redis/docker-library-redis/blob/$(fileCommit "$self")/$self 66 | 67 | Maintainers: David Maier (@dmaier-redislabs), 68 | Yossi Gottlieb (@yossigo) 69 | GitRepo: https://github.com/redis/docker-library-redis.git 70 | EOH 71 | 72 | # prints "$2$1$3$1...$N" 73 | join() { 74 | local sep="$1"; shift 75 | local out; printf -v out "${sep//%/%%}%s" "$@" 76 | echo "${out#$sep}" 77 | } 78 | 79 | for version; do 80 | export version 81 | 82 | fullVersion="$(jq -r '.[env.version].version' versions.json)" 83 | 84 | versionAliases=() 85 | while [ "$fullVersion" != "$version" ] && [ "${fullVersion%.*}" != "$fullVersion" ]; do 86 | versionAliases+=( $fullVersion ) 87 | fullVersion="${fullVersion%.*}" 88 | done 89 | versionAliases+=( 90 | $version 91 | ${aliases[$version]:-} 92 | ) 93 | 94 | for variant in debian alpine; do 95 | export variant 96 | dir="$version/$variant" 97 | 98 | commit="$(dirCommit "$dir")" 99 | 100 | if [ "$variant" = 'debian' ]; then 101 | variantAliases=( "${versionAliases[@]}" ) 102 | else 103 | variantAliases=( "${versionAliases[@]/%/-$variant}" ) 104 | variantAliases=( "${variantAliases[@]//latest-/}" ) 105 | fi 106 | 107 | parent="$(gawk 'toupper($1) == "FROM" { print $2 }' "$dir/Dockerfile")" 108 | arches="${parentRepoToArches[$parent]}" 109 | 110 | suite="${parent#*:}" # "bookworm-slim", "bookworm" 111 | suite="${suite%-slim}" # "bookworm" 112 | if [ "$variant" = 'alpine' ]; then 113 | suite="alpine$suite" # "alpine3.18" 114 | fi 115 | suiteAliases=( "${versionAliases[@]/%/-$suite}" ) 116 | suiteAliases=( "${suiteAliases[@]//latest-/}" ) 117 | variantAliases+=( "${suiteAliases[@]}" ) 118 | 119 | # calculate the intersection of parent image arches and gosu arches 120 | arches="$(jq -r --arg arches "$arches" ' 121 | ( 122 | $arches 123 | | gsub("^[[:space:]]+|[[:space:]]+$"; "") 124 | | split("[[:space:]]+"; "") 125 | ) as $parentArches 126 | | .[env.version] 127 | | $parentArches - ($parentArches - (.gosu.arches | keys)) 128 | | join(", ") 129 | ' versions.json)" 130 | 131 | echo 132 | cat <<-EOE 133 | Tags: $(join ', ' "${variantAliases[@]}") 134 | Architectures: $arches 135 | GitCommit: $commit 136 | Directory: $dir 137 | EOE 138 | done 139 | done 140 | -------------------------------------------------------------------------------- /generate-stackbrew-library.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -Eeuo pipefail 3 | 4 | declare -A aliases=( 5 | [7.4]='7 latest' 6 | [6.2]='6' 7 | ) 8 | 9 | self="$(basename "$BASH_SOURCE")" 10 | cd "$(dirname "$(readlink -f "$BASH_SOURCE")")" 11 | 12 | if [ "$#" -eq 0 ]; then 13 | versions="$(jq -r 'keys | map(@sh) | join(" ")' versions.json)" 14 | eval "set -- $versions" 15 | fi 16 | 17 | # sort version numbers with highest first 18 | IFS=$'\n'; set -- $(sort -rV <<<"$*"); unset IFS 19 | 20 | # get the most recent commit which modified any of "$@" 21 | fileCommit() { 22 | git log -1 --format='format:%H' HEAD -- "$@" 23 | } 24 | 25 | # get the most recent commit which modified "$1/Dockerfile" or any file COPY'd from "$1/Dockerfile" 26 | dirCommit() { 27 | local dir="$1"; shift 28 | ( 29 | cd "$dir" 30 | fileCommit \ 31 | Dockerfile \ 32 | $(git show HEAD:./Dockerfile | awk ' 33 | toupper($1) == "COPY" { 34 | for (i = 2; i < NF; i++) { 35 | print $i 36 | } 37 | } 38 | ') 39 | ) 40 | } 41 | 42 | getArches() { 43 | local repo="$1"; shift 44 | local officialImagesUrl='https://github.com/docker-library/official-images/raw/master/library/' 45 | 46 | eval "declare -g -A parentRepoToArches=( $( 47 | find -name 'Dockerfile' -exec awk ' 48 | toupper($1) == "FROM" && $2 !~ /^('"$repo"'|scratch|.*\/.*)(:|$)/ { 49 | print "'"$officialImagesUrl"'" $2 50 | } 51 | ' '{}' + \ 52 | | sort -u \ 53 | | xargs bashbrew cat --format '[{{ .RepoName }}:{{ .TagName }}]="{{ join " " .TagEntry.Architectures }}"' 54 | ) )" 55 | } 56 | getArches 'redis' 57 | 58 | cat <<-EOH 59 | # This file was generated via https://github.com/redis/docker-library-redis/blob/$(fileCommit "$self")/$self 60 | 61 | Maintainers: David Maier (@dmaier-redislabs), 62 | Yossi Gottlieb (@yossigo) 63 | GitRepo: https://github.com/redis/docker-library-redis.git 64 | EOH 65 | 66 | # prints "$2$1$3$1...$N" 67 | join() { 68 | local sep="$1"; shift 69 | local out; printf -v out "${sep//%/%%}%s" "$@" 70 | echo "${out#$sep}" 71 | } 72 | 73 | for version; do 74 | export version 75 | 76 | fullVersion="$(jq -r '.[env.version].version' versions.json)" 77 | 78 | versionAliases=() 79 | while [ "$fullVersion" != "$version" ] && [ "${fullVersion%.*}" != "$fullVersion" ]; do 80 | versionAliases+=( $fullVersion ) 81 | fullVersion="${fullVersion%.*}" 82 | done 83 | versionAliases+=( 84 | $version 85 | ${aliases[$version]:-} 86 | ) 87 | 88 | for variant in debian alpine; do 89 | export variant 90 | dir="$version/$variant" 91 | 92 | commit="$(dirCommit "$dir")" 93 | 94 | if [ "$variant" = 'debian' ]; then 95 | variantAliases=( "${versionAliases[@]}" ) 96 | else 97 | variantAliases=( "${versionAliases[@]/%/-$variant}" ) 98 | variantAliases=( "${variantAliases[@]//latest-/}" ) 99 | fi 100 | 101 | parent="$(awk 'toupper($1) == "FROM" { print $2 }' "$dir/Dockerfile")" 102 | arches="${parentRepoToArches[$parent]}" 103 | 104 | suite="${parent#*:}" # "bookworm-slim", "bookworm" 105 | suite="${suite%-slim}" # "bookworm" 106 | if [ "$variant" = 'alpine' ]; then 107 | suite="alpine$suite" # "alpine3.18" 108 | fi 109 | suiteAliases=( "${versionAliases[@]/%/-$suite}" ) 110 | suiteAliases=( "${suiteAliases[@]//latest-/}" ) 111 | variantAliases+=( "${suiteAliases[@]}" ) 112 | 113 | # calculate the intersection of parent image arches and gosu arches 114 | arches="$(jq -r --arg arches "$arches" ' 115 | ( 116 | $arches 117 | | gsub("^[[:space:]]+|[[:space:]]+$"; "") 118 | | split("[[:space:]]+"; "") 119 | ) as $parentArches 120 | | .[env.version] 121 | | $parentArches - ($parentArches - (.gosu.arches | keys)) 122 | | join(", ") 123 | ' versions.json)" 124 | 125 | echo 126 | cat <<-EOE 127 | Tags: $(join ', ' "${variantAliases[@]}") 128 | Architectures: $arches 129 | GitCommit: $commit 130 | Directory: $dir 131 | EOE 132 | done 133 | done 134 | -------------------------------------------------------------------------------- /stackbrew-generated/7-4.txt: -------------------------------------------------------------------------------- 1 | # This file was generated via https://github.com/redis/docker-library-redis/blob/d3809987c491cc61fa4f3c05ef0f4044e7fb6000/generate-stackbrew-library-mac.sh 2 | 3 | Maintainers: David Maier (@dmaier-redislabs), 4 | Yossi Gottlieb (@yossigo) 5 | GitRepo: https://github.com/redis/docker-library-redis.git 6 | 7 | Tags: 7.4.0, 7.4, 7, latest, 7.4.0-bookworm, 7.4-bookworm, 7-bookworm, bookworm 8 | Architectures: amd64, arm32v5, arm32v7, arm64v8, i386, mips64le, ppc64le, s390x 9 | GitCommit: 0ae559ebb19b1cafc36720e8de97839d5d402883 10 | Directory: 7.4/debian 11 | 12 | Tags: 7.4.0-alpine, 7.4-alpine, 7-alpine, alpine, 7.4.0-alpine3.20, 7.4-alpine3.20, 7-alpine3.20, alpine3.20 13 | Architectures: amd64, arm32v6, arm32v7, arm64v8, i386, ppc64le, riscv64, s390x 14 | GitCommit: 0ae559ebb19b1cafc36720e8de97839d5d402883 15 | Directory: 7.4/alpine 16 | 17 | Tags: 7.2.5, 7.2, 7.2.5-bookworm, 7.2-bookworm 18 | Architectures: amd64, arm32v5, arm32v7, arm64v8, i386, mips64le, ppc64le, s390x 19 | GitCommit: 5f08363e6d64b97a0c2e651f4bdcec6e71a32ab4 20 | Directory: 7.2/debian 21 | 22 | Tags: 7.2.5-alpine, 7.2-alpine, 7.2.5-alpine3.20, 7.2-alpine3.20 23 | Architectures: amd64, arm32v6, arm32v7, arm64v8, i386, ppc64le, riscv64, s390x 24 | GitCommit: 5f08363e6d64b97a0c2e651f4bdcec6e71a32ab4 25 | Directory: 7.2/alpine 26 | 27 | Tags: 7.0.15, 7.0, 7.0.15-bookworm, 7.0-bookworm 28 | Architectures: amd64, arm32v5, arm32v7, arm64v8, i386, mips64le, ppc64le, s390x 29 | GitCommit: 5f08363e6d64b97a0c2e651f4bdcec6e71a32ab4 30 | Directory: 7.0/debian 31 | 32 | Tags: 7.0.15-alpine, 7.0-alpine, 7.0.15-alpine3.20, 7.0-alpine3.20 33 | Architectures: amd64, arm32v6, arm32v7, arm64v8, i386, ppc64le, riscv64, s390x 34 | GitCommit: 5f08363e6d64b97a0c2e651f4bdcec6e71a32ab4 35 | Directory: 7.0/alpine 36 | 37 | Tags: 6.2.14, 6.2, 6, 6.2.14-bookworm, 6.2-bookworm, 6-bookworm 38 | Architectures: amd64, arm32v5, arm32v7, arm64v8, i386, mips64le, ppc64le, s390x 39 | GitCommit: 5f08363e6d64b97a0c2e651f4bdcec6e71a32ab4 40 | Directory: 6.2/debian 41 | 42 | Tags: 6.2.14-alpine, 6.2-alpine, 6-alpine, 6.2.14-alpine3.20, 6.2-alpine3.20, 6-alpine3.20 43 | Architectures: amd64, arm32v6, arm32v7, arm64v8, i386, ppc64le, riscv64, s390x 44 | GitCommit: 5f08363e6d64b97a0c2e651f4bdcec6e71a32ab4 45 | Directory: 6.2/alpine 46 | -------------------------------------------------------------------------------- /update.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -Eeuo pipefail 3 | 4 | cd "$(dirname "$(readlink -f "$BASH_SOURCE")")" 5 | 6 | ./versions.sh "$@" 7 | ./apply-templates.sh "$@" 8 | -------------------------------------------------------------------------------- /versions.json: -------------------------------------------------------------------------------- 1 | { 2 | "6.2": { 3 | "version": "6.2.18", 4 | "url": "http://download.redis.io/releases/redis-6.2.18.tar.gz", 5 | "sha256": "470c75bac73d7390be4dd66479c6f29e86371c5d380ce0c7efb4ba2bbda3612d", 6 | "debian": { 7 | "version": "bookworm" 8 | }, 9 | "alpine": { 10 | "version": "3.21" 11 | }, 12 | "gosu": { 13 | "version": "1.17", 14 | "arches": { 15 | "amd64": { 16 | "url": "https://github.com/tianon/gosu/releases/download/1.17/gosu-amd64", 17 | "sha256": "bbc4136d03ab138b1ad66fa4fc051bafc6cc7ffae632b069a53657279a450de3" 18 | }, 19 | "arm64v8": { 20 | "url": "https://github.com/tianon/gosu/releases/download/1.17/gosu-arm64", 21 | "sha256": "c3805a85d17f4454c23d7059bcb97e1ec1af272b90126e79ed002342de08389b" 22 | }, 23 | "arm32v5": { 24 | "url": "https://github.com/tianon/gosu/releases/download/1.17/gosu-armel", 25 | "sha256": "f9969910fa141140438c998cfa02f603bf213b11afd466dcde8fa940e700945d" 26 | }, 27 | "arm32v6": { 28 | "url": "https://github.com/tianon/gosu/releases/download/1.17/gosu-armhf", 29 | "sha256": "e5866286277ff2a2159fb9196fea13e0a59d3f1091ea46ddb985160b94b6841b" 30 | }, 31 | "i386": { 32 | "url": "https://github.com/tianon/gosu/releases/download/1.17/gosu-i386", 33 | "sha256": "087dbb8fe479537e64f9c86fa49ff3b41dee1cbd28739a19aaef83dc8186b1ca" 34 | }, 35 | "mips64le": { 36 | "url": "https://github.com/tianon/gosu/releases/download/1.17/gosu-mips64el", 37 | "sha256": "87140029d792595e660be0015341dfa1c02d1181459ae40df9f093e471d75b70" 38 | }, 39 | "ppc64le": { 40 | "url": "https://github.com/tianon/gosu/releases/download/1.17/gosu-ppc64el", 41 | "sha256": "1891acdcfa70046818ab6ed3c52b9d42fa10fbb7b340eb429c8c7849691dbd76" 42 | }, 43 | "riscv64": { 44 | "url": "https://github.com/tianon/gosu/releases/download/1.17/gosu-riscv64", 45 | "sha256": "38a6444b57adce135c42d5a3689f616fc7803ddc7a07ff6f946f2ebc67a26ba6" 46 | }, 47 | "s390x": { 48 | "url": "https://github.com/tianon/gosu/releases/download/1.17/gosu-s390x", 49 | "sha256": "69873bab588192f760547ca1f75b27cfcf106e9f7403fee6fd0600bc914979d0" 50 | }, 51 | "arm32v7": { 52 | "url": "https://github.com/tianon/gosu/releases/download/1.17/gosu-armhf", 53 | "sha256": "e5866286277ff2a2159fb9196fea13e0a59d3f1091ea46ddb985160b94b6841b" 54 | } 55 | } 56 | } 57 | }, 58 | "7.0": { 59 | "version": "7.0.15", 60 | "url": "http://download.redis.io/releases/redis-7.0.15.tar.gz", 61 | "sha256": "98066f5363504b26c34dd20fbcc3c957990d764cdf42576c836fc021073f4341", 62 | "debian": { 63 | "version": "bookworm" 64 | }, 65 | "alpine": { 66 | "version": "3.21" 67 | }, 68 | "gosu": { 69 | "version": "1.17", 70 | "arches": { 71 | "amd64": { 72 | "url": "https://github.com/tianon/gosu/releases/download/1.17/gosu-amd64", 73 | "sha256": "bbc4136d03ab138b1ad66fa4fc051bafc6cc7ffae632b069a53657279a450de3" 74 | }, 75 | "arm64v8": { 76 | "url": "https://github.com/tianon/gosu/releases/download/1.17/gosu-arm64", 77 | "sha256": "c3805a85d17f4454c23d7059bcb97e1ec1af272b90126e79ed002342de08389b" 78 | }, 79 | "arm32v5": { 80 | "url": "https://github.com/tianon/gosu/releases/download/1.17/gosu-armel", 81 | "sha256": "f9969910fa141140438c998cfa02f603bf213b11afd466dcde8fa940e700945d" 82 | }, 83 | "arm32v6": { 84 | "url": "https://github.com/tianon/gosu/releases/download/1.17/gosu-armhf", 85 | "sha256": "e5866286277ff2a2159fb9196fea13e0a59d3f1091ea46ddb985160b94b6841b" 86 | }, 87 | "i386": { 88 | "url": "https://github.com/tianon/gosu/releases/download/1.17/gosu-i386", 89 | "sha256": "087dbb8fe479537e64f9c86fa49ff3b41dee1cbd28739a19aaef83dc8186b1ca" 90 | }, 91 | "mips64le": { 92 | "url": "https://github.com/tianon/gosu/releases/download/1.17/gosu-mips64el", 93 | "sha256": "87140029d792595e660be0015341dfa1c02d1181459ae40df9f093e471d75b70" 94 | }, 95 | "ppc64le": { 96 | "url": "https://github.com/tianon/gosu/releases/download/1.17/gosu-ppc64el", 97 | "sha256": "1891acdcfa70046818ab6ed3c52b9d42fa10fbb7b340eb429c8c7849691dbd76" 98 | }, 99 | "riscv64": { 100 | "url": "https://github.com/tianon/gosu/releases/download/1.17/gosu-riscv64", 101 | "sha256": "38a6444b57adce135c42d5a3689f616fc7803ddc7a07ff6f946f2ebc67a26ba6" 102 | }, 103 | "s390x": { 104 | "url": "https://github.com/tianon/gosu/releases/download/1.17/gosu-s390x", 105 | "sha256": "69873bab588192f760547ca1f75b27cfcf106e9f7403fee6fd0600bc914979d0" 106 | }, 107 | "arm32v7": { 108 | "url": "https://github.com/tianon/gosu/releases/download/1.17/gosu-armhf", 109 | "sha256": "e5866286277ff2a2159fb9196fea13e0a59d3f1091ea46ddb985160b94b6841b" 110 | } 111 | } 112 | } 113 | }, 114 | "7.2": { 115 | "version": "7.2.9", 116 | "url": "http://download.redis.io/releases/redis-7.2.9.tar.gz", 117 | "sha256": "2343cc49db3beb9d2925a44e13032805a608821a58f25bd874c84881115a20b7", 118 | "debian": { 119 | "version": "bookworm" 120 | }, 121 | "alpine": { 122 | "version": "3.21" 123 | }, 124 | "gosu": { 125 | "version": "1.17", 126 | "arches": { 127 | "amd64": { 128 | "url": "https://github.com/tianon/gosu/releases/download/1.17/gosu-amd64", 129 | "sha256": "bbc4136d03ab138b1ad66fa4fc051bafc6cc7ffae632b069a53657279a450de3" 130 | }, 131 | "arm64v8": { 132 | "url": "https://github.com/tianon/gosu/releases/download/1.17/gosu-arm64", 133 | "sha256": "c3805a85d17f4454c23d7059bcb97e1ec1af272b90126e79ed002342de08389b" 134 | }, 135 | "arm32v5": { 136 | "url": "https://github.com/tianon/gosu/releases/download/1.17/gosu-armel", 137 | "sha256": "f9969910fa141140438c998cfa02f603bf213b11afd466dcde8fa940e700945d" 138 | }, 139 | "arm32v6": { 140 | "url": "https://github.com/tianon/gosu/releases/download/1.17/gosu-armhf", 141 | "sha256": "e5866286277ff2a2159fb9196fea13e0a59d3f1091ea46ddb985160b94b6841b" 142 | }, 143 | "i386": { 144 | "url": "https://github.com/tianon/gosu/releases/download/1.17/gosu-i386", 145 | "sha256": "087dbb8fe479537e64f9c86fa49ff3b41dee1cbd28739a19aaef83dc8186b1ca" 146 | }, 147 | "mips64le": { 148 | "url": "https://github.com/tianon/gosu/releases/download/1.17/gosu-mips64el", 149 | "sha256": "87140029d792595e660be0015341dfa1c02d1181459ae40df9f093e471d75b70" 150 | }, 151 | "ppc64le": { 152 | "url": "https://github.com/tianon/gosu/releases/download/1.17/gosu-ppc64el", 153 | "sha256": "1891acdcfa70046818ab6ed3c52b9d42fa10fbb7b340eb429c8c7849691dbd76" 154 | }, 155 | "riscv64": { 156 | "url": "https://github.com/tianon/gosu/releases/download/1.17/gosu-riscv64", 157 | "sha256": "38a6444b57adce135c42d5a3689f616fc7803ddc7a07ff6f946f2ebc67a26ba6" 158 | }, 159 | "s390x": { 160 | "url": "https://github.com/tianon/gosu/releases/download/1.17/gosu-s390x", 161 | "sha256": "69873bab588192f760547ca1f75b27cfcf106e9f7403fee6fd0600bc914979d0" 162 | }, 163 | "arm32v7": { 164 | "url": "https://github.com/tianon/gosu/releases/download/1.17/gosu-armhf", 165 | "sha256": "e5866286277ff2a2159fb9196fea13e0a59d3f1091ea46ddb985160b94b6841b" 166 | } 167 | } 168 | } 169 | }, 170 | "7.4-rc": { 171 | "version": "7.4-rc2", 172 | "url": "http://download.redis.io/releases/redis-7.4-rc2.tar.gz", 173 | "sha256": "6f3ca6e196b5757bf51752ea9944cbc927731c771aeab661be8c2c05bd1edbce", 174 | "debian": { 175 | "version": "bookworm" 176 | }, 177 | "alpine": { 178 | "version": "3.21" 179 | }, 180 | "gosu": { 181 | "version": "1.17", 182 | "arches": { 183 | "amd64": { 184 | "url": "https://github.com/tianon/gosu/releases/download/1.17/gosu-amd64", 185 | "sha256": "bbc4136d03ab138b1ad66fa4fc051bafc6cc7ffae632b069a53657279a450de3" 186 | }, 187 | "arm64v8": { 188 | "url": "https://github.com/tianon/gosu/releases/download/1.17/gosu-arm64", 189 | "sha256": "c3805a85d17f4454c23d7059bcb97e1ec1af272b90126e79ed002342de08389b" 190 | }, 191 | "arm32v5": { 192 | "url": "https://github.com/tianon/gosu/releases/download/1.17/gosu-armel", 193 | "sha256": "f9969910fa141140438c998cfa02f603bf213b11afd466dcde8fa940e700945d" 194 | }, 195 | "arm32v6": { 196 | "url": "https://github.com/tianon/gosu/releases/download/1.17/gosu-armhf", 197 | "sha256": "e5866286277ff2a2159fb9196fea13e0a59d3f1091ea46ddb985160b94b6841b" 198 | }, 199 | "i386": { 200 | "url": "https://github.com/tianon/gosu/releases/download/1.17/gosu-i386", 201 | "sha256": "087dbb8fe479537e64f9c86fa49ff3b41dee1cbd28739a19aaef83dc8186b1ca" 202 | }, 203 | "mips64le": { 204 | "url": "https://github.com/tianon/gosu/releases/download/1.17/gosu-mips64el", 205 | "sha256": "87140029d792595e660be0015341dfa1c02d1181459ae40df9f093e471d75b70" 206 | }, 207 | "ppc64le": { 208 | "url": "https://github.com/tianon/gosu/releases/download/1.17/gosu-ppc64el", 209 | "sha256": "1891acdcfa70046818ab6ed3c52b9d42fa10fbb7b340eb429c8c7849691dbd76" 210 | }, 211 | "riscv64": { 212 | "url": "https://github.com/tianon/gosu/releases/download/1.17/gosu-riscv64", 213 | "sha256": "38a6444b57adce135c42d5a3689f616fc7803ddc7a07ff6f946f2ebc67a26ba6" 214 | }, 215 | "s390x": { 216 | "url": "https://github.com/tianon/gosu/releases/download/1.17/gosu-s390x", 217 | "sha256": "69873bab588192f760547ca1f75b27cfcf106e9f7403fee6fd0600bc914979d0" 218 | }, 219 | "arm32v7": { 220 | "url": "https://github.com/tianon/gosu/releases/download/1.17/gosu-armhf", 221 | "sha256": "e5866286277ff2a2159fb9196fea13e0a59d3f1091ea46ddb985160b94b6841b" 222 | } 223 | } 224 | } 225 | }, 226 | "7.4": { 227 | "version": "7.4.4", 228 | "url": "http://download.redis.io/releases/redis-7.4.4.tar.gz", 229 | "sha256": "985c465146453f4d79912e70b2dc516577a1667cbf9b0420a0c87878fcc6f32f", 230 | "debian": { 231 | "version": "bookworm" 232 | }, 233 | "alpine": { 234 | "version": "3.21" 235 | }, 236 | "gosu": { 237 | "version": "1.17", 238 | "arches": { 239 | "amd64": { 240 | "url": "https://github.com/tianon/gosu/releases/download/1.17/gosu-amd64", 241 | "sha256": "bbc4136d03ab138b1ad66fa4fc051bafc6cc7ffae632b069a53657279a450de3" 242 | }, 243 | "arm64v8": { 244 | "url": "https://github.com/tianon/gosu/releases/download/1.17/gosu-arm64", 245 | "sha256": "c3805a85d17f4454c23d7059bcb97e1ec1af272b90126e79ed002342de08389b" 246 | }, 247 | "arm32v5": { 248 | "url": "https://github.com/tianon/gosu/releases/download/1.17/gosu-armel", 249 | "sha256": "f9969910fa141140438c998cfa02f603bf213b11afd466dcde8fa940e700945d" 250 | }, 251 | "arm32v6": { 252 | "url": "https://github.com/tianon/gosu/releases/download/1.17/gosu-armhf", 253 | "sha256": "e5866286277ff2a2159fb9196fea13e0a59d3f1091ea46ddb985160b94b6841b" 254 | }, 255 | "i386": { 256 | "url": "https://github.com/tianon/gosu/releases/download/1.17/gosu-i386", 257 | "sha256": "087dbb8fe479537e64f9c86fa49ff3b41dee1cbd28739a19aaef83dc8186b1ca" 258 | }, 259 | "mips64le": { 260 | "url": "https://github.com/tianon/gosu/releases/download/1.17/gosu-mips64el", 261 | "sha256": "87140029d792595e660be0015341dfa1c02d1181459ae40df9f093e471d75b70" 262 | }, 263 | "ppc64le": { 264 | "url": "https://github.com/tianon/gosu/releases/download/1.17/gosu-ppc64el", 265 | "sha256": "1891acdcfa70046818ab6ed3c52b9d42fa10fbb7b340eb429c8c7849691dbd76" 266 | }, 267 | "riscv64": { 268 | "url": "https://github.com/tianon/gosu/releases/download/1.17/gosu-riscv64", 269 | "sha256": "38a6444b57adce135c42d5a3689f616fc7803ddc7a07ff6f946f2ebc67a26ba6" 270 | }, 271 | "s390x": { 272 | "url": "https://github.com/tianon/gosu/releases/download/1.17/gosu-s390x", 273 | "sha256": "69873bab588192f760547ca1f75b27cfcf106e9f7403fee6fd0600bc914979d0" 274 | }, 275 | "arm32v7": { 276 | "url": "https://github.com/tianon/gosu/releases/download/1.17/gosu-armhf", 277 | "sha256": "e5866286277ff2a2159fb9196fea13e0a59d3f1091ea46ddb985160b94b6841b" 278 | } 279 | } 280 | } 281 | } 282 | } 283 | -------------------------------------------------------------------------------- /versions.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -Eeuo pipefail 3 | 4 | alpine="$( 5 | bashbrew cat --format '{{ .TagEntry.Tags | join "\n" }}' https://github.com/docker-library/official-images/raw/HEAD/library/alpine:latest \ 6 | | grep -E '^[0-9]+[.][0-9]+$' 7 | )" 8 | [ "$(wc -l <<<"$alpine")" = 1 ] 9 | export alpine 10 | 11 | debian="$( 12 | bashbrew cat --format '{{ .TagEntry.Tags | join "\n" }}' https://github.com/docker-library/official-images/raw/HEAD/library/debian:latest \ 13 | | grep -vE '^latest$|[0-9.-]' \ 14 | | head -1 15 | )" 16 | [ "$(wc -l <<<"$debian")" = 1 ] 17 | export debian 18 | 19 | gosus="$( 20 | git ls-remote --tags https://github.com/tianon/gosu.git \ 21 | | cut -d/ -f3- \ 22 | | cut -d^ -f1 \ 23 | | grep -E '^[0-9]+' \ 24 | | sort -urV 25 | )" 26 | gosu= 27 | for possible in $gosus; do 28 | urlBase="https://github.com/tianon/gosu/releases/download/$possible" 29 | if shas="$(wget -qO- "$urlBase/SHA256SUMS")" && [ -n "$shas" ]; then 30 | gosu="$(jq <<<"$shas" -csR --arg version "$possible" --arg urlBase "$urlBase" '{ 31 | version: $version, 32 | arches: ( 33 | rtrimstr("\n") 34 | | split("\n") 35 | | map( 36 | # this capture will naturally ignore the ".asc" file checksums 37 | capture( 38 | [ 39 | "^(?[0-9a-f]{64})", 40 | "( | [*])", 41 | "(?", 42 | "gosu-", 43 | "(?[^_. -]+)", 44 | ")$" 45 | ] | join("") 46 | ) 47 | | { 48 | ( 49 | # convert dpkg arch into bashbrew arch 50 | { 51 | # https://salsa.debian.org/dpkg-team/dpkg/-/blob/main/data/cputable 52 | # https://wiki.debian.org/ArchitectureSpecificsMemo#Architecture_baselines 53 | # http://deb.debian.org/debian/dists/unstable/main/ 54 | # http://deb.debian.org/debian/dists/stable/main/ 55 | # https://deb.debian.org/debian-ports/dists/unstable/main/ 56 | amd64: "amd64", 57 | armel: "arm32v5", 58 | armhf: "arm32v6", # https://github.com/tianon/gosu/blob/2dada3bb5dfbc1e7162a29907691b6f45995d54e/Dockerfile#L52-L53 59 | arm64: "arm64v8", 60 | i386: "i386", 61 | mips64el: "mips64le", 62 | ppc64el: "ppc64le", 63 | riscv64: "riscv64", 64 | s390x: "s390x", 65 | }[.dpkgArch] // empty 66 | ): { 67 | url: ($urlBase + "/" + .file), 68 | sha256: .sha256, 69 | }, 70 | } 71 | ) 72 | | add 73 | | if has("arm32v6") and (has("arm32v7") | not) then 74 | .arm32v7 = .arm32v6 75 | else . end 76 | ), 77 | }')" 78 | break 79 | fi 80 | done 81 | [ -n "$gosu" ] 82 | export gosu 83 | 84 | cd "$(dirname "$(readlink -f "$BASH_SOURCE")")" 85 | 86 | versions=( "$@" ) 87 | if [ ${#versions[@]} -eq 0 ]; then 88 | versions=( */ ) 89 | json='{}' 90 | else 91 | json="$(< versions.json)" 92 | fi 93 | versions=( "${versions[@]%/}" ) 94 | 95 | packages="$( 96 | wget -qO- 'https://github.com/redis/redis-hashes/raw/master/README' \ 97 | | jq -csR ' 98 | rtrimstr("\n") 99 | | split("\n") 100 | | map( 101 | # this capture will naturally ignore comments and blank lines 102 | capture( 103 | [ 104 | "^hash[[:space:]]+", 105 | "(?redis-", 106 | "(?([0-9.]+)(-rc[0-9]+)?)", 107 | "[.][^[:space:]]+)[[:space:]]+", 108 | "(?sha256|sha1)[[:space:]]+", # this filters us down to just the checksum types we are prepared to handle right now 109 | "(?[0-9a-f]{64}|[0-9a-f]{40})[[:space:]]+", 110 | "(?[^[:space:]]+)", 111 | "$" 112 | ] | join("") 113 | ) 114 | | { 115 | version: .version, 116 | url: .url, 117 | (.type): .sum, 118 | } 119 | ) 120 | ' 121 | )" 122 | 123 | for version in "${versions[@]}"; do 124 | export version rcVersion="${version%-rc}" 125 | 126 | doc="$( 127 | jq <<<"$packages" -c ' 128 | map( 129 | select( 130 | .version 131 | | ( 132 | startswith(env.rcVersion + ".") 133 | or startswith(env.rcVersion + "-") 134 | ) and ( 135 | index("-") 136 | | if env.version == env.rcVersion then not else . end 137 | ) 138 | ) 139 | )[-1] 140 | ' 141 | )" 142 | 143 | fullVersion="$(jq <<<"$doc" -r '.version')" 144 | echo "$version: $fullVersion" 145 | 146 | json="$(jq <<<"$json" -c --argjson doc "$doc" ' 147 | .[env.version] = ($doc + { 148 | debian: { version: env.debian }, 149 | alpine: { version: env.alpine }, 150 | gosu: (env.gosu | fromjson), 151 | }) 152 | ')" 153 | done 154 | 155 | jq <<<"$json" . > versions.json 156 | --------------------------------------------------------------------------------