containers-redis/Dockerfile

35 lines
1.2 KiB
Docker

ARG ALPINE_VERSION=3.13.6
ARG BASE_IMAGE=gitea.nulo.in/sutty/monit
FROM ${BASE_IMAGE}:${ALPINE_VERSION} AS build
LABEL org.opencontainers.image.authors="f@sutty.nl"
ARG REDIS_VERSION=6.2.7
ARG MAX_MEMORY=100mb
ENV MAX_MEMORY=${MAX_MEMORY}
RUN apk add --no-cache redis~${REDIS_VERSION}
RUN sed -re "/^bind /d" -i /etc/redis.conf
RUN sed -re "/^protected-mode /d" -i /etc/redis.conf
RUN sed -re "/^logfile /d" -i /etc/redis.conf
RUN sed -re "s/^# (syslog-enabled).*/\1 yes/" -i /etc/redis.conf
RUN echo "pidfile /run/redis/redis.pid" >> /etc/redis.conf
RUN echo "daemonize yes" >> /etc/redis.conf
RUN echo "protected-mode no" >> /etc/redis.conf
RUN echo "maxmemory-policy allkeys-lfu" >> /etc/redis.conf
RUN echo "maxmemory ${MAX_MEMORY}" >> /etc/redis.conf
RUN echo "save \"\"" >> /etc/redis.conf
ARG ALPINE_VERSION=3.13.6
ARG BASE_IMAGE=sutty/monit
FROM ${BASE_IMAGE}:${ALPINE_VERSION}
LABEL org.opencontainers.image.authors="f@sutty.nl"
ARG REDIS_VERSION=6.2.7
RUN apk add --no-cache redis~${REDIS_VERSION} su-exec
COPY --from=build /etc/redis.conf /etc/redis.conf
COPY ./monit.conf /etc/monit.d/redis.conf
COPY ./redisd.sh /usr/local/bin/redisd
EXPOSE 6379
VOLUME "/var/lib/redis"