-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
54 lines (45 loc) · 1.32 KB
/
Dockerfile
File metadata and controls
54 lines (45 loc) · 1.32 KB
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
# Build Stage
FROM debian:trixie-slim AS builder
ARG REDIS_VERSION
# Build dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates \
wget \
curl \
dpkg-dev \
pkg-config \
gcc \
g++ \
libc6-dev \
libssl-dev \
make \
cmake \
git \
python3 \
python3-pip \
python3-venv \
python3-dev \
unzip \
rsync \
clang \
automake \
autoconf \
libtool
# Download Redis
RUN curl -fsSL https://github.com/redis/redis/archive/refs/tags/${REDIS_VERSION}.tar.gz | tar xz
# Build Redis server without modules which need rust
RUN cd redis-${REDIS_VERSION} && make redis-server BUILD_STATIC=yes BUILD_WITH_SYSTEMD=no BUILD_WITH_MODULES=no BUILD_TLS=no DISABLE_WERRORS=yes -j$(nproc) LDFLAGS="-static"
# Build Redis client
RUN cd redis-${REDIS_VERSION} && make redis-cli BUILD_STATIC=yes BUILD_TLS=no DISABLE_WERRORS=yes -j$(nproc) LDFLAGS="-static"
# Final Stage
FROM gcr.io/distroless/cc
ARG REDIS_VERSION
# Redis binaries
COPY --from=builder /redis-${REDIS_VERSION}/src/redis-server /usr/local/bin/redis-server
COPY --from=builder /redis-${REDIS_VERSION}/src/redis-cli /usr/local/bin/redis-cli
# Volume for persistence
VOLUME ["/data"]
USER nonroot
EXPOSE 6379 9121
ENTRYPOINT ["/usr/local/bin/redis-server"]
CMD ["/etc/redis.conf"]