Skip to content

Add simple Alpine-based variant #40

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 8, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ services: docker
env:
- VERSION=3.0 VARIANT=
- VERSION=3.0 VARIANT=32bit
- VERSION=3.0 VARIANT=alpine
- VERSION=2.8 VARIANT=
- VERSION=2.8 VARIANT=32bit

Expand Down
53 changes: 53 additions & 0 deletions 3.0/alpine/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
FROM alpine:3.3

# add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added
RUN addgroup -S redis && adduser -S -G redis redis

ENV GOSU_GPG_KEY B42F6819007F00F88E364FD4036A9C25BF357DD4
ENV GOSU_VERSION 1.7

# grab gosu for easy step-down from root
RUN apk add --no-cache --virtual .gosu-deps \
dpkg \
gnupg \
openssl \
&& gpg --keyserver ha.pool.sks-keyservers.net --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4 \
&& wget -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$(dpkg --print-architecture)" \
&& wget -O /usr/local/bin/gosu.asc "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$(dpkg --print-architecture).asc" \
&& gpg --verify /usr/local/bin/gosu.asc \
&& rm /usr/local/bin/gosu.asc \
&& chmod +x /usr/local/bin/gosu \
&& rm -r ~/.gnupg \
&& apk del .gosu-deps

ENV REDIS_VERSION 3.0.6
ENV REDIS_DOWNLOAD_URL http://download.redis.io/releases/redis-3.0.6.tar.gz
ENV REDIS_DOWNLOAD_SHA1 4b1c7b1201984bca8f7f9c6c58862f6928cf0a25

# for redis-sentinel see: http://redis.io/topics/sentinel
RUN set -x \
&& apk add --no-cache --virtual .build-deps \
gcc \
linux-headers \
make \
musl-dev \
&& wget "$REDIS_DOWNLOAD_URL" -O redis.tar.gz \
&& echo "$REDIS_DOWNLOAD_SHA1 *redis.tar.gz" | sha1sum -c - \
&& mkdir -p /usr/src \
&& tar -xzf redis.tar.gz -C /usr/src \
&& mv "/usr/src/redis-$REDIS_VERSION" /usr/src/redis \
&& rm redis.tar.gz \
&& make -C /usr/src/redis \
&& make -C /usr/src/redis install \
&& rm -r /usr/src/redis \
&& apk del .build-deps

RUN mkdir /data && chown redis:redis /data
VOLUME /data
WORKDIR /data

COPY docker-entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]

EXPOSE 6379
CMD [ "redis-server" ]
9 changes: 9 additions & 0 deletions 3.0/alpine/docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/sh
set -e

if [ "$1" = 'redis-server' ]; then
chown -R redis .
exec gosu redis "$@"
fi

exec "$@"
2 changes: 1 addition & 1 deletion generate-stackbrew-library.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ for version in "${versions[@]}"; do
echo "$va: ${url}@${commit} $version"
done

for variant in 32bit; do
for variant in 32bit alpine; do
[ -f "$version/$variant/Dockerfile" ] || continue
commit="$(cd "$version/$variant" && git log -1 --format='format:%H' -- Dockerfile $(awk 'toupper($1) == "COPY" { for (i = 2; i < NF; i++) { print $i } }' Dockerfile))"
echo
Expand Down
7 changes: 5 additions & 2 deletions update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,12 @@ for version in "${versions[@]}"; do
s/^(ENV REDIS_VERSION) .*/\1 '"$fullVersion"'/;
s/^(ENV REDIS_DOWNLOAD_URL) .*/\1 '"$downloadUrl"'/;
s/^(ENV REDIS_DOWNLOAD_SHA1) .*/\1 '"$shaHash"'/
' "$version"{/,/32bit/}"Dockerfile"
' "$version"/{,*/}Dockerfile
)
travisEnv='\n - VERSION='"$version VARIANT=32bit$travisEnv"
for variant in alpine 32bit; do
[ -d "$version/$variant" ] || continue
travisEnv='\n - VERSION='"$version VARIANT=$variant$travisEnv"
done
travisEnv='\n - VERSION='"$version VARIANT=$travisEnv"
done

Expand Down