Skip to content

Instantly share code, notes, and snippets.

@SharkFourSix
Last active October 10, 2023 16:49
Show Gist options
  • Save SharkFourSix/4d1b4ced0cbc2b231524ffd2e7565755 to your computer and use it in GitHub Desktop.
Save SharkFourSix/4d1b4ced0cbc2b231524ffd2e7565755 to your computer and use it in GitHub Desktop.
Small docker image file for containerizing redis binary.
# syntax=docker/dockerfile:experimental
# Build staticly linked version of redis
FROM alpine:3.18.4 as redis-builds
ADD https://download.redis.io/redis-stable.tar.gz .
ADD https://liquidtelecom.dl.sourceforge.net/project/tcl/Tcl/8.6.13/tcl8.6.13-src.tar.gz .
RUN set -ex && \
apk add --no-cache make && \
apk add --no-cache gcc musl-dev
RUN tar -xzf redis-stable.tar.gz \
&& tar -xzf tcl8.6.13-src.tar.gz \
&& cd tcl8.6.13/unix \
&& ./configure \
&& make \
&& make install \
&& cd ../../redis-stable/src \
&& make MALLOC=libc CFLAGS="-static" EXEEXT="-static" LDFLAGS="-static -I/usr/local/include/"
FROM scratch
WORKDIR /app
COPY --from=redis-builds /redis-stable/src/redis-server /app/
# If not overriden in docker-compose.yml
# EXPOSE 6379
ENTRYPOINT [ "/app/redis-server","--protected-mode","no", "--port", "6379", "--bind", "*", "-::*", "--timeout", "0", "--tcp-backlog", "511", "--tcp-keepalive", "300"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment