Skip to content

Commit aa2fb6e

Browse files
author
Developer
committed
fix: base agent image on debian-slim to get mariadb-binlog
Alpine 3.20 ships no *binlog* binary in any of mariadb-client / mariadb-server-utils / mariadb-server — verified by fetching every mariadb-* apk and grepping contents. The dynamic lookup added in 5a270f1 was therefore searching for a file that does not exist. Debian's mariadb-client does include /usr/bin/mariadb-binlog (but not the mysqlbinlog compat symlink), so base the agent on debian:12-slim, install mariadb-client, and create the symlink ourselves. ~150MB vs ~600MB for mysql:8.0 as base, and mariadb-binlog parses both MariaDB and MySQL binlogs.
1 parent 5a270f1 commit aa2fb6e

1 file changed

Lines changed: 15 additions & 17 deletions

File tree

Dockerfile

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -41,27 +41,25 @@ RUN npm run build
4141
# =============================================================================
4242
# Stage 3: Agent image
4343
# =============================================================================
44-
FROM alpine:3.20 AS agent
45-
46-
# mariadb-client provides mariadb-binlog, which the agent uses to parse local
47-
# binlog files. We locate the binary dynamically (path varies across Alpine /
48-
# MariaDB versions) and expose it as mysqlbinlog for the agent's PATH lookup.
49-
RUN set -e && \
50-
apk add --no-cache ca-certificates tzdata mariadb-client mariadb-server-utils && \
51-
BINLOG="$(command -v mariadb-binlog || true)" && \
52-
if [ -z "$BINLOG" ]; then \
53-
BINLOG="$(find /usr -type f -name 'mariadb-binlog' 2>/dev/null | head -n1)"; \
54-
fi && \
55-
if [ -z "$BINLOG" ]; then \
56-
echo "ERROR: mariadb-binlog not found after apk add" >&2; exit 1; \
57-
fi && \
58-
ln -sf "$BINLOG" /usr/bin/mysqlbinlog && \
59-
/usr/bin/mysqlbinlog --version >/dev/null && \
60-
echo "linked mysqlbinlog -> $BINLOG"
44+
# Base on debian:slim and install mariadb-client, which provides both
45+
# mariadb-binlog and a /usr/bin/mysqlbinlog compatibility symlink. Alpine
46+
# 3.20's mariadb packaging splits the binlog tool out of mariadb-client /
47+
# mariadb-server-utils / mariadb-server entirely, but Debian's packaging
48+
# keeps it where it belongs. mariadb-binlog parses both MariaDB and MySQL
49+
# binlogs. ~150MB vs ~600MB for mysql:8.0 as the agent base.
50+
FROM debian:12-slim AS agent
51+
52+
RUN apt-get update && apt-get install -y --no-install-recommends \
53+
ca-certificates tzdata mariadb-client && \
54+
rm -rf /var/lib/apt/lists/* && \
55+
ln -sf /usr/bin/mariadb-binlog /usr/bin/mysqlbinlog && \
56+
test -x /usr/bin/mysqlbinlog && \
57+
mysqlbinlog --version
6158

6259
COPY --from=builder /build/mysql-pitr-agent /usr/local/bin/mysql-pitr-agent
6360

6461
ENTRYPOINT ["mysql-pitr-agent"]
62+
CMD []
6563

6664
# =============================================================================
6765
# Stage 4: Server image

0 commit comments

Comments
 (0)