-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.runtime
More file actions
53 lines (44 loc) · 2.19 KB
/
Copy pathDockerfile.runtime
File metadata and controls
53 lines (44 loc) · 2.19 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
# syntax=docker/dockerfile:1
#
# Release runtime image assembled from PREBUILT binaries — it performs no
# compilation. The release workflow (.github/workflows/release.yml) compiles
# hyperbytedb / hyperbytedb-cli per architecture in parallel on GitHub-hosted
# runners, uploads staging artifacts, and points this Dockerfile at the merged
# tree as its build context:
#
# release-staging/
# amd64/{hyperbytedb, hyperbytedb-cli, libchdb.so}
# arm64/{hyperbytedb, hyperbytedb-cli, libchdb.so}
#
# A single multi-platform `docker buildx build` then selects the right per-arch
# directory via the BuildKit-provided $TARGETARCH (amd64 / arm64), so the only
# work done under QEMU emulation is the trivial apt layer below — never a Rust
# compile. For building the image from source (local / kind) use ./Dockerfile.
FROM debian:bookworm-slim
# Set automatically by buildx per target platform: "amd64" or "arm64". Selects
# which staging subdirectory to copy from.
ARG TARGETARCH
RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates libstdc++6 curl \
&& rm -rf /var/lib/apt/lists/*
COPY ${TARGETARCH}/libchdb.so /usr/local/lib/libchdb.so
RUN ldconfig
COPY ${TARGETARCH}/hyperbytedb /usr/local/bin/hyperbytedb
COPY ${TARGETARCH}/hyperbytedb-cli /usr/local/bin/hyperbytedb-cli
RUN mkdir -p /var/lib/hyperbytedb/wal /var/lib/hyperbytedb/meta \
/var/lib/hyperbytedb/chdb /var/lib/hyperbytedb/raft
ENV HYPERBYTEDB__STORAGE__WAL_DIR=/var/lib/hyperbytedb/wal \
HYPERBYTEDB__STORAGE__META_DIR=/var/lib/hyperbytedb/meta \
HYPERBYTEDB__CHDB__SESSION_DATA_PATH=/var/lib/hyperbytedb/chdb \
HYPERBYTEDB__CLUSTER__RAFT_DIR=/var/lib/hyperbytedb/raft \
HYPERBYTEDB__LOGGING__LEVEL=info
# Cap glibc's per-thread heap arenas. Without this, glibc creates up to
# ~8×CPU arenas of 64 MiB each — we observed 22 of them resident in
# production, contributing ~200–300 MiB of fragmented anonymous RSS
# that the application never asked for. `2` is the conventional
# server-side Rust+Tokio setting: enough to avoid the single-arena
# contention pathology, small enough that fragmentation stays bounded.
ENV MALLOC_ARENA_MAX=2
EXPOSE 8086
ENTRYPOINT ["hyperbytedb"]
CMD ["serve"]