# syntax=docker/dockerfile:1 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 apk add --no-cache build-base openssl-dev WORKDIR /src COPY . . ARG VERSION=0.1.0-dev # With .prebuilt/ the static aarch64 binaries are cross-compiled on the # development machine (deploy/Dockerfile.cross); otherwise build and test from # source on this host. RUN if [ -x .prebuilt/bokfd ]; then \ mkdir -p build && \ cp .prebuilt/bokfd .prebuilt/bokfctl build/; \ else \ make -j"$(nproc)" backend VERSION="$VERSION" \ && make test-core VERSION="$VERSION"; \ fi \ && strip build/bokfd build/bokfctl # The runtime image carries the daemon and bokfctl only, statically linked # against OpenSSL and the C library; the ncurses TUI is a frontend built on the # machine you sit at. FROM alpine:3.24 AS runtime RUN apk add --no-cache 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 /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 RUN chmod 0755 /usr/local/bin/docker-entrypoint.sh ENV BOKFD_DB=/var/lib/bokfd/bokfd.db \ BOKFD_SOCKET=/run/bokfd/bokfd.sock \ BOKFD_BACKUP_DIR=/var/lib/bokfd/backup \ BOKFD_EXPORT_DIR=/var/lib/bokfd/export VOLUME ["/var/lib/bokfd", "/run/bokfd"] HEALTHCHECK --interval=10s --timeout=3s --start-period=3s --retries=3 \ CMD ["bokfctl", "health"] ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"] CMD ["bokfd"]