-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e691fc7
commit 69b11b2
Showing
7 changed files
with
350 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
FROM debian:stretch-slim | ||
|
||
# add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added | ||
RUN groupadd -r redis && useradd -r -g redis redis | ||
|
||
# grab gosu for easy step-down from root | ||
# https://github.com/tianon/gosu/releases | ||
ENV GOSU_VERSION 1.10 | ||
RUN set -ex; \ | ||
\ | ||
fetchDeps=" \ | ||
ca-certificates \ | ||
dirmngr \ | ||
gnupg \ | ||
wget \ | ||
"; \ | ||
apt-get update; \ | ||
apt-get install -y --no-install-recommends $fetchDeps; \ | ||
rm -rf /var/lib/apt/lists/*; \ | ||
\ | ||
dpkgArch="$(dpkg --print-architecture | awk -F- '{ print $NF }')"; \ | ||
wget -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$dpkgArch"; \ | ||
wget -O /usr/local/bin/gosu.asc "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$dpkgArch.asc"; \ | ||
export GNUPGHOME="$(mktemp -d)"; \ | ||
gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4; \ | ||
gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu; \ | ||
gpgconf --kill all; \ | ||
rm -r "$GNUPGHOME" /usr/local/bin/gosu.asc; \ | ||
chmod +x /usr/local/bin/gosu; \ | ||
gosu nobody true; \ | ||
\ | ||
apt-get purge -y --auto-remove $fetchDeps | ||
|
||
ENV REDIS_VERSION 5.0.2 | ||
ENV REDIS_DOWNLOAD_URL http://download.redis.io/releases/redis-5.0.2.tar.gz | ||
ENV REDIS_DOWNLOAD_SHA 937dde6164001c083e87316aa20dad2f8542af089dfcb1cbb64f9c8300cd00ed | ||
|
||
# for redis-sentinel see: http://redis.io/topics/sentinel | ||
RUN set -ex; \ | ||
\ | ||
buildDeps=' \ | ||
ca-certificates \ | ||
wget \ | ||
\ | ||
gcc \ | ||
libc6-dev \ | ||
make \ | ||
'; \ | ||
apt-get update; \ | ||
apt-get install -y $buildDeps --no-install-recommends; \ | ||
rm -rf /var/lib/apt/lists/*; \ | ||
\ | ||
wget -O redis.tar.gz "$REDIS_DOWNLOAD_URL"; \ | ||
echo "$REDIS_DOWNLOAD_SHA *redis.tar.gz" | sha256sum -c -; \ | ||
mkdir -p /usr/src/redis; \ | ||
tar -xzf redis.tar.gz -C /usr/src/redis --strip-components=1; \ | ||
rm redis.tar.gz; \ | ||
\ | ||
# disable Redis protected mode [1] as it is unnecessary in context of Docker | ||
# (ports are not automatically exposed when running inside Docker, but rather explicitly by specifying -p / -P) | ||
# [1]: https://github.com/antirez/redis/commit/edd4d555df57dc84265fdfb4ef59a4678832f6da | ||
grep -q '^#define CONFIG_DEFAULT_PROTECTED_MODE 1$' /usr/src/redis/src/server.h; \ | ||
sed -ri 's!^(#define CONFIG_DEFAULT_PROTECTED_MODE) 1$!\1 0!' /usr/src/redis/src/server.h; \ | ||
grep -q '^#define CONFIG_DEFAULT_PROTECTED_MODE 0$' /usr/src/redis/src/server.h; \ | ||
# for future reference, we modify this directly in the source instead of just supplying a default configuration flag because apparently "if you specify any argument to redis-server, [it assumes] you are going to specify everything" | ||
# see also https://github.com/docker-library/redis/issues/4#issuecomment-50780840 | ||
# (more exactly, this makes sure the default behavior of "save on SIGTERM" stays functional by default) | ||
\ | ||
make -C /usr/src/redis -j "$(nproc)"; \ | ||
make -C /usr/src/redis install; \ | ||
\ | ||
rm -r /usr/src/redis; \ | ||
\ | ||
apt-get purge -y --auto-remove $buildDeps | ||
|
||
RUN mkdir /data && chown redis:redis /data | ||
VOLUME /data | ||
WORKDIR /data | ||
|
||
COPY docker-entrypoint.sh /usr/local/bin/ | ||
RUN ln -s usr/local/bin/docker-entrypoint.sh / # backwards compat | ||
ENTRYPOINT ["docker-entrypoint.sh"] | ||
|
||
EXPOSE 6379 | ||
CMD ["redis-server"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Genesis/Apla Redis Queue Container | ||
|
||
## Prototype Source | ||
|
||
https://github.com/docker-library/redis/blob/master/5.0/Dockerfile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/bin/sh | ||
set -e | ||
|
||
# first arg is `-f` or `--some-option` | ||
# or first arg is `something.conf` | ||
if [ "${1#-}" != "$1" ] || [ "${1%.conf}" != "$1" ]; then | ||
set -- redis-server "$@" | ||
fi | ||
|
||
# allow the container to be started with `--user` | ||
if [ "$1" = 'redis-server' -a "$(id -u)" = '0' ]; then | ||
find . \! -user redis -exec chown redis '{}' + | ||
exec gosu redis "$0" "$@" | ||
fi | ||
|
||
exec "$@" |
Oops, something went wrong.