forked from OT-CONTAINER-KIT/redis
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
72 lines (45 loc) · 1.68 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
FROM alpine:3.15 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_DOWNLOAD_URL="http://download.redis.io/"
ARG REDIS_VERSION="stable"
RUN apk add --no-cache su-exec tzdata make curl build-base linux-headers bash openssl-dev
WORKDIR /tmp
RUN curl -fL -Lo redis-${REDIS_VERSION}.tar.gz ${REDIS_DOWNLOAD_URL}/redis-${REDIS_VERSION}.tar.gz && \
tar xvzf redis-${REDIS_VERSION}.tar.gz
WORKDIR /tmp/redis-${REDIS_VERSION}
RUN make && \
make install BUILD_TLS=yes
FROM alpine:3.15
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 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"]