-
Notifications
You must be signed in to change notification settings - Fork 51
/
Copy pathDockerfile
81 lines (56 loc) · 2.22 KB
/
Dockerfile
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
74
75
76
77
78
79
80
81
FROM alpine:3.19 as builder
LABEL maintainer="Opstree Solutions"
ARG TARGETARCH
LABEL version=1.0 \
arch=$TARGETARCH \
description="A production grade performance tuned redis docker image created by Opstree Solutions"
ARG REDIS_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_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
LABEL maintainer="Opstree Solutions"
ARG TARGETARCH
ENV REDIS_PORT=6379
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-server /usr/local/bin/redis-server
COPY --from=builder /usr/local/bin/redis-cli /usr/local/bin/redis-cli
RUN apk update && apk upgrade
RUN addgroup -S -g 1000 redis && adduser -S -G redis -u 1000 redis && \
apk add --no-cache bash
COPY redis.conf /etc/redis/redis.conf
COPY entrypoint.sh /usr/bin/entrypoint.sh
COPY setupMasterSlave.sh /usr/bin/setupMasterSlave.sh
COPY healthcheck.sh /usr/bin/healthcheck.sh
RUN chown -R 1000:0 /etc/redis && \
chmod -R g+rw /etc/redis && \
mkdir /data && \
chown -R 1000:0 /data && \
chmod -R g+rw /data && \
mkdir /node-conf && \
chown -R 1000:0 /node-conf && \
chmod -R g+rw /node-conf && \
chmod -R g+rw /var/run
VOLUME ["/data"]
VOLUME ["/node-conf"]
WORKDIR /data
EXPOSE ${REDIS_PORT}
USER 1000
ENTRYPOINT ["/usr/bin/entrypoint.sh"]