-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
73 lines (59 loc) · 2.41 KB
/
Copy pathDockerfile
File metadata and controls
73 lines (59 loc) · 2.41 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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
ARG VALKEY_VERSION
ARG BUILD_RDMA=0
FROM --platform=$TARGETPLATFORM alpine:latest AS builder
ARG VALKEY_VERSION
ARG BUILD_RDMA
ENV VALKEY_VERSION=${VALKEY_VERSION}
ENV BUILD_RDMA=${BUILD_RDMA}
RUN apk add --no-cache \
build-base \
cmake \
pkgconfig \
linux-headers \
perl \
git \
wget \
openssl-dev \
zlib-dev \
bzip2-dev \
ca-certificates
WORKDIR /src
RUN set -eux; \
if [ -n "$VALKEY_VERSION" ]; then \
VER="$VALKEY_VERSION"; \
else \
VER="$(wget -qO- https://api.github.com/repos/valkey-io/valkey/releases/latest | awk -F\" '/"tag_name":/ {print $4; exit}')" ; \
fi; \
echo "Building valkey version: $VER"; \
wget -qO /tmp/valkey.tar.gz "https://github.com/valkey-io/valkey/archive/refs/tags/${VER}.tar.gz"; \
tar -xzf /tmp/valkey.tar.gz --strip-components=1 -C /src
RUN set -eux; \
extraJemallocConfigureFlags=""; \
case "$(apk --print-arch)" in \
x86_64 | x86 | i386) extraJemallocConfigureFlags="--with-lg-page=12" ;; \
*) extraJemallocConfigureFlags="--with-lg-page=16" ;; \
esac; \
extraJemallocConfigureFlags="$extraJemallocConfigureFlags --with-lg-hugepage=21"; \
grep -F 'cd jemalloc && ./configure ' /src/deps/Makefile; \
sed -ri 's!cd jemalloc && ./configure !&'"$extraJemallocConfigureFlags"' !' /src/deps/Makefile; \
grep -F 'cd jemalloc && ./configure ' /src/deps/Makefile
RUN set -eux; \
uname -a || true; \
NPROC=$(getconf _NPROCESSORS_ONLN || echo 1); \
export VALKEY_DEBUG_BUILD=0; \
make -C src -j${NPROC} BUILD_TLS=yes BUILD_RDMA=${BUILD_RDMA}
RUN set -eux; \
cd src; \
for f in valkey-server valkey-cli valkey-benchmark valkey-check-aof valkey-check-rdb; do \
if [ -f "$f" ]; then strip "$f" || true; fi; \
done
FROM alpine:latest AS runtime
RUN apk add --no-cache ca-certificates
COPY --from=builder /src/src/valkey-server /usr/local/bin/valkey-server
COPY --from=builder /src/src/valkey-cli /usr/local/bin/valkey-cli
COPY --from=builder /src/src/valkey-benchmark /usr/local/bin/valkey-benchmark
COPY --from=builder /src/src/valkey-check-aof /usr/local/bin/valkey-check-aof
COPY --from=builder /src/src/valkey-check-rdb /usr/local/bin/valkey-check-rdb
RUN chmod +x /usr/local/bin/valkey-server /usr/local/bin/valkey-cli /usr/local/bin/valkey-benchmark /usr/local/bin/valkey-check-aof /usr/local/bin/valkey-check-rdb || true
EXPOSE 6379
ENTRYPOINT ["/usr/local/bin/valkey-server"]