diff options
| author | Anders Betts <anders.betts@gmail.com> | 2026-09-20 09:20:39 +0200 |
|---|---|---|
| committer | Anders Betts <anders.betts@gmail.com> | 2026-09-20 09:20:39 +0200 |
| commit | a3ad2857f7b47202cd7ff74f965d09d691b06317 (patch) | |
| tree | 2740835a8a58ae3fe98d5cff7598c6fbed2a8d68 /Dockerfile | |
| parent | 5b27bb0950fd03d29c223b5960faff89baf37970 (diff) | |
| download | bokf-a3ad2857f7b47202cd7ff74f965d09d691b06317.tar.gz bokf-a3ad2857f7b47202cd7ff74f965d09d691b06317.zip | |
deploy: alpine runtime image with the daemon and CLI onlyv0.1.45
Diffstat (limited to 'Dockerfile')
| -rw-r--r-- | Dockerfile | 34 |
1 files changed, 12 insertions, 22 deletions
@@ -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 |
