docker: ship anime_sort.lua but don't load a script by default

Bundle the example Lua scripts under /app/scripts and have the entrypoint
load one only when NAUT_SCRIPT is set. NAUT_SCRIPT is left unset by
default, so the daemon starts with no script; set it (e.g.
/app/scripts/anime_sort.lua) to opt in.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
ookami125 2026-06-26 00:30:21 -04:00
parent 6107846fc9
commit eb226b4af3

View file

@ -82,6 +82,10 @@ COPY --from=build /src/build/torrent-peer/libtorrentpeer.so /usr/local/lib
COPY --from=build /src/build/torrent-tracker/libtorrenttracker.so /usr/local/lib/ COPY --from=build /src/build/torrent-tracker/libtorrenttracker.so /usr/local/lib/
RUN ldconfig RUN ldconfig
# Bundled Lua scripts (anime_sort.lua and friends). Loaded by default via
# NAUT_SCRIPT below; the daemon runs one script at a time.
COPY --from=build /src/examples /app/scripts
# Defaults — override any of these at `docker run` time with -e. # Defaults — override any of these at `docker run` time with -e.
ENV NAUT_WEBUI_HOST=0.0.0.0 \ ENV NAUT_WEBUI_HOST=0.0.0.0 \
NAUT_WEBUI_PORT=8080 \ NAUT_WEBUI_PORT=8080 \
@ -93,14 +97,17 @@ ENV NAUT_WEBUI_HOST=0.0.0.0 \
# NAUT_AUTH_USER=admin # default # NAUT_AUTH_USER=admin # default
# NAUT_AUTH_PASSWORD=... # generated + printed to the log if unset # NAUT_AUTH_PASSWORD=... # generated + printed to the log if unset
# NAUT_SESSION_TTL=604800 # login lifetime in seconds (default 7d) # NAUT_SESSION_TTL=604800 # login lifetime in seconds (default 7d)
# NAUT_SCRIPT=/app/scripts/anime_sort.lua # set to load a script at startup
# Create the data/download/socket dirs (if the volume is fresh) then exec the # Create the data/download/socket dirs (if the volume is fresh) then exec the
# daemon with the webui plugin. Built with printf (single-quoted lines keep the # daemon with the webui plugin and the configured script. Built with printf
# $VARs literal) so the image stays a single Dockerfile on any builder. # (single-quoted lines keep the $VARs literal) so the image stays a single
# Dockerfile on any builder. --script is only added when NAUT_SCRIPT is set.
RUN printf '%s\n' \ RUN printf '%s\n' \
'#!/bin/sh' \ '#!/bin/sh' \
'set -e' \ 'set -e' \
'mkdir -p "$NAUT_STATE_DIR" "$NAUT_WEBUI_SAVE_PATH" "$(dirname "$NAUT_WEBUI_DB")" "$(dirname "$NAUT_SOCKET")"' \ 'mkdir -p "$NAUT_STATE_DIR" "$NAUT_WEBUI_SAVE_PATH" "$(dirname "$NAUT_WEBUI_DB")" "$(dirname "$NAUT_SOCKET")"' \
'[ -n "$NAUT_SCRIPT" ] && set -- --script "$NAUT_SCRIPT" "$@"' \
'exec /app/nautd --socket "$NAUT_SOCKET" --plugin /app/naut_webui.so --state-dir "$NAUT_STATE_DIR" "$@"' \ 'exec /app/nautd --socket "$NAUT_SOCKET" --plugin /app/naut_webui.so --state-dir "$NAUT_STATE_DIR" "$@"' \
> /usr/local/bin/entrypoint.sh \ > /usr/local/bin/entrypoint.sh \
&& chmod +x /usr/local/bin/entrypoint.sh && chmod +x /usr/local/bin/entrypoint.sh