11# syntax=docker/dockerfile:1.3
2-
32# =============================================================================
43# SPDX-FileCopyrightText: 2016 - 2026 Leapsight
54# SPDX-License-Identifier: Apache-2.0
65# =============================================================================
76
8-
97# =============================================================================
108# Build stage 1
119# =============================================================================
12-
1310FROM erlang:27.3.4 AS builder
1411
15- # Install build dependencies
12+ # Install build dependencies.
13+ # libsnappy-dev (headers) is correct HERE — the NIFs that link snappy are
14+ # compiled in this stage. The runtime stage only needs the shared library.
1615RUN --mount=type=cache,id=apt,sharing=locked,target=/var/cache/apt apt-get update && \
1716 apt-get -y install --no-install-recommends \
1817 build-essential \
@@ -21,7 +20,7 @@ RUN --mount=type=cache,id=apt,sharing=locked,target=/var/cache/apt apt-get updat
2120 libssl-dev \
2221 libsnappy-dev \
2322 curl && \
24- rm -rf /var/lib/apt/lists/*
23+ rm -rf /var/lib/apt/lists/*
2524
2625WORKDIR /bondy/src
2726
@@ -35,13 +34,18 @@ RUN mkdir -p /bondy/rel
3534RUN rebar3 as docker tar && \
3635 tar -zxvf /bondy/src/_build/docker/rel/*/*.tar.gz -C /bondy/rel/
3736
38-
3937# =============================================================================
4038# Build stage 2
4139# =============================================================================
42-
43- # debian bookworm
44- FROM debian:stable-slim as runner
40+ # debian trixie (Debian 13). `debian:stable-slim` rolled from bookworm to
41+ # trixie, so watch the Debian 13 security tracker for this image.
42+ #
43+ # For reproducible, audit-friendly builds, pin the base by digest instead of
44+ # the floating tag, e.g.:
45+ # FROM debian:trixie-slim@sha256:<digest> AS runner
46+ # You can get the current digest with:
47+ # docker buildx imagetools inspect debian:trixie-slim
48+ FROM debian:trixie-slim AS runner
4549
4650# We define defaults
4751# We assume you have DNS. Erlang will take the FQDN and generate
@@ -55,38 +59,46 @@ ENV ERL_DIST_PORT=27780
5559
5660# We add Bondy executables to PATH
5761ENV PATH="/bondy/bin:$PATH"
62+
5863# This is required so that relx replaces the vm.args
5964# BONDY_ERL_NODENAME and BONDY_ERL_DISTRIBUTED_COOKIE variables
6065ENV RELX_REPLACE_OS_VARS=true
6166
6267ENV HOME "/bondy"
6368
64- # We install the following utils:
65- # - bash
66- # - procps: which includes the commands free, kill, pkill, pgrep, pmap, ps,
67- # pwdx, skill, slabtop, snice, sysctl, tload, top, uptime, vmstat, w, and
68- # watch
69- # - iproute2: a collection of utilities for networking and traffic control.
70- # - net-tools: which includes the commands arp, ifconfig, netstat, rarp, nameif
71- # and route
72- # - nano: for devops
69+ # Runtime packages — kept deliberately minimal to reduce CVE surface.
70+ #
71+ # - bash : entrypoint / relx boot scripts
72+ # - procps : ps, top, free, kill, sysctl, etc. (ops diagnostics)
73+ # - iproute2 : ip, ss (replaces the deprecated net-tools)
74+ # - openssl : required by the Erlang crypto application
75+ # - libsnappy1v5 : runtime shared lib for snappy compression (not the -dev headers)
7376#
74- # We install the following required packages:
75- # - openssl: required by Erlang crypto application
76- # We setup the bondy group and user and the /bondy dir
77- # We also create the /bondy/etc dir to avoid an issue when deploying in K8s
78- # where the permissions are not assigned to the directory and Bondy will not
79- # have permission to write.
77+ # Deliberately NOT installed (each removed a CVE class):
78+ # - sudo : container runs as the single non-root `bondy` user; no use for
79+ # it, and it carried a HIGH (CVE-2026-35535).
80+ # - dnsutils : pulls bind9-libs -> libxml2 + libkrb5, the source of 5 HIGH /
81+ # several MEDIUM findings with NO upstream fix. Bondy resolves
82+ # DNS via the Erlang runtime; dig/nslookup are not needed.
83+ # - nano : editor, not needed in a production image (2 CVEs).
84+ # - net-tools : deprecated; superseded by iproute2.
85+ #
86+ # `apt-get upgrade` ensures base-image packages pick up Debian security updates
87+ # (glibc, systemd, libcap2, nghttp2, ...) rather than staying frozen at the
88+ # versions cached in the base layer.
8089RUN apt-get update && \
90+ apt-get -y upgrade && \
8191 apt-get -y install --no-install-recommends \
82- sudo bash procps iproute2 net-tools dnsutils nano openssl libsnappy-dev \
92+ bash procps iproute2 openssl libsnappy1v5 \
93+ && apt-get -y autoremove && apt-get clean \
8394 && rm -rf /var/lib/apt/lists/* \
8495 && groupadd -g 1000 -r bondy \
8596 && useradd -u 1000 -r -g bondy -d /bondy -s /bin/bash -c "bondy" bondy \
8697 && mkdir -p /bondy/etc \
8798 && chown bondy:bondy /bondy/etc
8899
89100WORKDIR /bondy
101+
90102USER bondy:bondy
91103
92104# Copy the release to workdir
@@ -99,7 +111,7 @@ COPY --chown=bondy:bondy --from=builder /bondy/rel .
99111EXPOSE 18080/tcp
100112# ADMIN API HTTP (Default: 18081)
101113EXPOSE 18081/tcp
102- # WAMP TCP (Default: 18082)
114+ # WAMP TCP (Default: 18082)
103115EXPOSE 18082/tcp
104116# API GATEWAY HTTPS and WSS (Default: 18083)
105117EXPOSE 18083/tcp
0 commit comments