-
Notifications
You must be signed in to change notification settings - Fork 51
/
Dockerfile.sentinel
73 lines (50 loc) · 2.09 KB
/
Dockerfile.sentinel
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
FROM alpine:3.19 as builder
ARG TARGETARCH
LABEL version=1.0 \
arch=$TARGETARCH \
description="A production grade performance tuned redis docker image created by Opstree Solutions"
ARG REDIS_SENTINEL_VERSION="stable"
RUN apk add --no-cache su-exec tzdata make curl build-base linux-headers bash openssl-dev
WORKDIR /tmp
RUN VERSION=$(echo ${REDIS_SENTINEL_VERSION} | sed -e "s/^v//g"); \
case "${VERSION}" in \
latest | stable) REDIS_DOWNLOAD_URL="http://download.redis.io/redis-stable.tar.gz" && VERSION="stable";; \
*) REDIS_DOWNLOAD_URL="http://download.redis.io/releases/redis-${VERSION}.tar.gz";; \
esac; \
\
curl -fL -Lo redis-${VERSION}.tar.gz ${REDIS_DOWNLOAD_URL}; \
tar xvzf redis-${VERSION}.tar.gz; \
\
arch="$(uname -m)"; \
extraJemallocConfigureFlags="--with-lg-page=16"; \
if [ "$arch" = "aarch64" ] || [ "$arch" = "arm64" ]; then \
sed -ri 's!cd jemalloc && ./configure !&'"$extraJemallocConfigureFlags"' !' /tmp/redis-${VERSION}/deps/Makefile; \
fi; \
export BUILD_TLS=yes; \
make -C redis-${VERSION} all; \
make -C redis-${VERSION} install
FROM alpine:3.19
ARG TARGETARCH
ENV SENTINEL_PORT=26379
LABEL version=1.0 \
arch=$TARGETARCH \
description="A production grade performance tuned redis docker image created by Opstree Solutions"
COPY --from=builder /usr/local/bin/redis-cli /usr/local/bin/redis-cli
COPY --from=builder /usr/local/bin/redis-sentinel /usr/local/bin/redis-sentinel
RUN apk update && apk upgrade
RUN addgroup -S -g 1000 redis && adduser -S -G redis -u 1000 redis && \
apk add --no-cache bash
COPY sentinel.conf /etc/redis/sentinel.conf
COPY entrypoint-sentinel.sh /usr/bin/entrypoint-sentinel.sh
COPY healthcheck-Sentinel.sh /usr/bin/healthcheck.sh
RUN chown -R 1000:0 /etc/redis && \
chmod -R g+rw /etc/redis && \
mkdir /sentinel-data && \
chown -R 1000:0 /sentinel-data && \
chmod -R g+rw /sentinel-data && \
chmod -R g+rw /var/run
VOLUME ["/sentinel-data"]
WORKDIR /sentinel-data
EXPOSE ${SENTINEL_PORT}
USER 1000
ENTRYPOINT ["/usr/bin/entrypoint-sentinel.sh"]