# syntax=docker/dockerfile:1
# labelviewer 1.0.1 for Linux arm64: a ready-to-use image of the binary in this directory.
#
#   docker build -t labelviewer:1.0.1 .
#   docker run -d --name labelviewer -p 10090:10090 labelviewer:1.0.1
#
# The binary is a self-contained executable (Node.js v24.22.0 inside) built for glibc. Any glibc-based base works
# (Debian, Ubuntu, Red Hat UBI, gcr.io/distroless/cc-debian12): replace the FROM line with your approved image of the
# same architecture. Alpine (musl) is not supported. See "Build your own image" in docs/install.md (portal: /install/).
FROM --platform=linux/arm64 debian:bookworm-slim

COPY --chown=root:root labelviewer /usr/local/bin/labelviewer
COPY --chown=root:root EULA.txt NOTICE.txt /usr/share/doc/labelviewer/

# Configuration is environment only: PORT, HOST, LICENSE_KEY or LICENSE_FILE (your production license; without them the
# included evaluation license is used, and label images are watermarked), RENDER_WORKERS,
# RENDER_TIMEOUT_MS, RENDER_MAX_QUEUE, RENDER_MAX_HEAP_MB, REQUEST_TIMEOUT_MS, ACCESS_LOG.
# The server writes nothing: no volume needed, a read-only root filesystem works.
ENV PORT=10090 \
    HOST=0.0.0.0

# Unprivileged user (no entry in /etc/passwd needed).
USER 10001:10001
EXPOSE 10090
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 CMD ["labelviewer", "health"]
# `serve` by default; other subcommands run as one-off containers, e.g. `docker run --rm labelviewer:1.0.1 version`.
ENTRYPOINT ["labelviewer"]
CMD ["serve"]
