Update Dockerfile for pre-generated help artifacts and navi

- Install navi for Ctrl+G interactive cheatsheet browsing
- COPY pre-generated artifacts (tools.db, 397 cheatsheets, 15
  workflows, TLDR pages) instead of build-time generation
- Configure cheat tool with /home/remnux/.cheat path
- Symlink navi cheatsheets to /opt/cheatsheets/personal/
- Add welcome.sh to /usr/local/bin/ for all shells
- Configure bash navi widget in /etc/bash.bashrc

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
tobias
2026-03-28 17:38:52 +01:00
parent 3a8e5d90ef
commit b13db23a5e
+45 -23
View File
@@ -25,7 +25,7 @@ RUN apt-get update && apt-get install -y \
zsh-syntax-highlighting \
&& apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# Configure pip
# Configure pip
ENV PYTHONDONTWRITEBYTECODE=1
ADD pip.conf /etc/pip.conf
@@ -40,30 +40,41 @@ RUN PIPX_HOME=/opt/pipx PIPX_BIN_DIR=/usr/local/bin pipx install --include-deps
RUN PIPX_HOME=/opt/pipx PIPX_BIN_DIR=/usr/local/bin pipx install --include-deps cheat \
&& PIPX_HOME=/opt/pipx PIPX_BIN_DIR=/usr/local/bin pipx install --include-deps tldr
# Removed navi - focus on tldr and cheat for reliable help system
# Install navi (interactive cheatsheet browser, Ctrl+G)
RUN curl -sL https://raw.githubusercontent.com/denisidoro/navi/master/scripts/install | BIN_DIR=/usr/local/bin bash 2>/dev/null \
|| echo "navi installation skipped (offline build)"
# Create data directory and set permissions
RUN mkdir -p /data \
&& chown remnux:remnux /data
# Add documentation and streamlined help system
# Add documentation and shell configuration
ADD files/README /opt/README
ADD files/welcome.sh /usr/local/bin/welcome.sh
ADD files/command_help /opt/command_help
ADD files/zshrc /etc/zsh/zshrc
ADD files/fish_config.fish /etc/fish/conf.d/remnux.fish
ADD scripts/create-offline-help-system.sh /usr/local/bin/create-offline-help-system.sh
RUN chmod +x /usr/local/bin/welcome.sh
# Add help system scripts
ADD scripts/find-tool /usr/local/bin/find-tool
ADD scripts/fhelp /usr/local/bin/fhelp
ADD scripts/check-help-coverage.sh /usr/local/bin/check-help-coverage.sh
RUN chmod +x /usr/local/bin/find-tool /usr/local/bin/fhelp /usr/local/bin/check-help-coverage.sh
# Install pre-generated help artifacts (built via: make generate-master)
ADD data/generated/tools.db /opt/remnux-docs/tools.db
ADD data/generated/cheatsheets/ /opt/cheatsheets/personal/
ADD data/generated/workflows/ /opt/remnux-docs/workflows/
ADD cheatsheets/ /opt/cheatsheets/
# Install legacy help scripts (kept for compatibility)
ADD scripts/create-offline-help-system.sh /usr/local/bin/create-offline-help-system.sh
ADD scripts/import-remnux-cheatsheets.sh /usr/local/bin/import-remnux-cheatsheets.sh
ADD scripts/convert-remnux-cheats.py /usr/local/bin/convert-remnux-cheats.py
ADD scripts/add-tool-cheats.sh /usr/local/bin/add-tool-cheats.sh
ADD scripts/check-help-coverage.sh /usr/local/bin/check-help-coverage.sh
# Create streamlined offline help system (tldr + cheat)
RUN chmod +x /usr/local/bin/create-offline-help-system.sh /usr/local/bin/find-tool /usr/local/bin/fhelp /usr/local/bin/import-remnux-cheatsheets.sh \
&& chmod +x /usr/local/bin/convert-remnux-cheats.py /usr/local/bin/add-tool-cheats.sh /usr/local/bin/check-help-coverage.sh \
&& /usr/local/bin/create-offline-help-system.sh \
&& /usr/local/bin/add-tool-cheats.sh
RUN chmod +x /usr/local/bin/create-offline-help-system.sh /usr/local/bin/import-remnux-cheatsheets.sh \
&& chmod +x /usr/local/bin/convert-remnux-cheats.py /usr/local/bin/add-tool-cheats.sh
# Install Oh My Zsh for remnux user (minimal installation)
RUN su - remnux -c 'sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended' || true \
@@ -71,20 +82,31 @@ RUN su - remnux -c 'sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzs
&& find /home/remnux/.oh-my-zsh/plugins -mindepth 1 -maxdepth 1 -type d ! -name git ! -name docker ! -name command-not-found ! -name colored-man-pages -exec rm -rf {} + 2>/dev/null || true \
&& rm -rf /home/remnux/.cache/* /tmp/* 2>/dev/null || true
# Update bashrc with welcome message and comprehensive help info
RUN echo 'cat /opt/README' >> /etc/bash.bashrc \
&& echo 'echo ""' >> /etc/bash.bashrc \
&& echo 'echo "📚 Comprehensive Help System:"' >> /etc/bash.bashrc \
&& echo 'echo " fhelp - Complete file analysis help"' >> /etc/bash.bashrc \
&& echo 'echo " fhelp tools pdf - Find PDF analysis tools"' >> /etc/bash.bashrc \
&& echo 'echo " fhelp cheat pdfid.py - Show command examples"' >> /etc/bash.bashrc \
&& echo 'echo " fhelp examples - Browse all examples"' >> /etc/bash.bashrc \
&& echo 'echo " fhelp pdf - PDF analysis workflow"' >> /etc/bash.bashrc \
&& echo 'echo ""' >> /etc/bash.bashrc \
&& echo 'echo " Shells: bash (default), zsh (with Oh My Zsh), fish"' >> /etc/bash.bashrc \
&& echo 'echo ""' >> /etc/bash.bashrc \
# Configure navi cheatsheet path
RUN mkdir -p /home/remnux/.local/share/navi/cheats \
&& ln -sf /opt/cheatsheets/personal /home/remnux/.local/share/navi/cheats/remnux \
&& chown -R remnux:remnux /home/remnux/.local/share/navi 2>/dev/null || true
# Configure cheat tool — Python cheat v2.x uses DEFAULT_CHEAT_DIR env var
# Create cheat-compatible copies (without .cheat extension) in the cheat directory
RUN mkdir -p /home/remnux/.cheat \
&& for f in /opt/cheatsheets/personal/*.cheat; do \
base=$(basename "$f" .cheat); \
cp "$f" "/home/remnux/.cheat/$base"; \
done \
&& chown -R remnux:remnux /home/remnux/.cheat
ENV DEFAULT_CHEAT_DIR=/home/remnux/.cheat
# Configure bash welcome (login shells only)
RUN echo '# Welcome message (login shells only)' >> /etc/bash.bashrc \
&& echo 'if [ -z "$_WELCOME_SHOWN" ] && [ -f /usr/local/bin/welcome.sh ]; then' >> /etc/bash.bashrc \
&& echo ' source /usr/local/bin/welcome.sh' >> /etc/bash.bashrc \
&& echo 'fi' >> /etc/bash.bashrc \
&& echo 'alias analyse="fhelp"' >> /etc/bash.bashrc \
&& echo 'alias h="fhelp"' >> /etc/bash.bashrc \
&& echo 'alias ?="fhelp"' >> /etc/bash.bashrc \
&& echo '# Navi widget for bash (Ctrl+G)' >> /etc/bash.bashrc \
&& echo 'command -v navi >/dev/null 2>&1 && eval "$(navi widget bash)" 2>/dev/null' >> /etc/bash.bashrc \
&& rm -rf /var/cache/* /tmp/* /var/tmp/* /home/remnux/.cache/* /root/.cache/* 2>/dev/null || true
# Switch to remnux user (REMnux default user)