diff --git a/Dockerfile b/Dockerfile index f21e44a..d42df26 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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/ 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. ENV NAUT_WEBUI_HOST=0.0.0.0 \ NAUT_WEBUI_PORT=8080 \ @@ -93,14 +97,17 @@ ENV NAUT_WEBUI_HOST=0.0.0.0 \ # NAUT_AUTH_USER=admin # default # NAUT_AUTH_PASSWORD=... # generated + printed to the log if unset # 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 -# daemon with the webui plugin. Built with printf (single-quoted lines keep the -# $VARs literal) so the image stays a single Dockerfile on any builder. +# daemon with the webui plugin and the configured script. Built with printf +# (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' \ '#!/bin/sh' \ 'set -e' \ '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" "$@"' \ > /usr/local/bin/entrypoint.sh \ && chmod +x /usr/local/bin/entrypoint.sh