From a3ad2857f7b47202cd7ff74f965d09d691b06317 Mon Sep 17 00:00:00 2001 From: Anders Betts Date: Sun, 20 Sep 2026 09:20:39 +0200 Subject: deploy: alpine runtime image with the daemon and CLI only --- Dockerfile | 34 ++++++++++++---------------------- 1 file changed, 12 insertions(+), 22 deletions(-) (limited to 'Dockerfile') diff --git a/Dockerfile b/Dockerfile index b7fae08..65ce8df 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,35 +1,25 @@ # syntax=docker/dockerfile:1 -FROM debian:bookworm-slim AS build +FROM alpine:3.24 AS build # VERSION is declared after the expensive layers: the legacy builder # invalidates every layer that follows a changed build argument. -RUN apt-get update \ - && apt-get install -y --no-install-recommends build-essential libncurses-dev \ - libssl-dev \ - && rm -rf /var/lib/apt/lists/* +RUN apk add --no-cache build-base openssl-dev WORKDIR /src COPY . . ARG VERSION=0.1.0-dev -# With .prebuilt/ the binaries are cross-compiled on the development machine -# (see deploy/Dockerfile.cross); otherwise build and test from source. -RUN if [ -x .prebuilt/bokfd ]; then \ - mkdir -p build && \ - cp .prebuilt/bokfd .prebuilt/bokfctl .prebuilt/bokftui build/; \ - else \ - make -j"$(nproc)" VERSION="$VERSION" && make test VERSION="$VERSION"; \ - fi +RUN make -j"$(nproc)" backend VERSION="$VERSION" \ + && make test-core VERSION="$VERSION" \ + && strip build/bokfd build/bokfctl -FROM debian:bookworm-slim AS runtime -RUN apt-get update \ - && apt-get install -y --no-install-recommends libncursesw6 libssl3 \ - ca-certificates util-linux \ - && rm -rf /var/lib/apt/lists/* \ - && useradd --system --uid 10001 --home-dir /var/lib/bokfd \ - --shell /usr/sbin/nologin bokfd \ +# The runtime image carries the daemon and bokfctl only. The ncurses TUI is a +# frontend: build it from source on the machine you sit at. +FROM alpine:3.24 AS runtime +RUN apk add --no-cache libssl3 ca-certificates util-linux \ + && addgroup -S bokfd \ + && adduser -S -D -H -u 10001 -G bokfd -s /sbin/nologin bokfd \ && install -d -o bokfd -g bokfd /var/lib/bokfd /var/lib/bokfd/backup \ /var/lib/bokfd/export /var/lib/bokfd/certs /run/bokfd -COPY --from=build /src/build/bokfd /src/build/bokfctl /src/build/bokftui \ - /usr/local/bin/ +COPY --from=build /src/build/bokfd /src/build/bokfctl /usr/local/bin/ COPY --from=build /src/data/bas_k2.csv /src/data/bas_k3.csv \ /usr/local/share/bokf/ COPY deploy/docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh -- cgit v1.3