Skip to content

fix(docker): fail fast on build patch failures and add healthcheck - #2

Open
devin-ai-integration[bot] wants to merge 1 commit into
mainfrom
devin/1786521705-fail-fast-build
Open

fix(docker): fail fast on build patch failures and add healthcheck#2
devin-ai-integration[bot] wants to merge 1 commit into
mainfrom
devin/1786521705-fail-fast-build

Conversation

@devin-ai-integration

Copy link
Copy Markdown

Summary

The repo is just a Dockerfile, so the error-handling gaps are all in the build/run of the image. The dangerous ones are the sed patches: sed exits 0 when its pattern matches nothing, so if upstream nut v3.3 ever changes conf/nut.default.conf or requirements.txt, the build still succeeds and ships an image that scans the wrong directory or tries to install PyQt5 — a silent misconfiguration discovered only at runtime. Each patch now asserts its own result:

RUN sed -i '/scan/c "scan": ["\/titles"]' /root/nut/conf/nut.conf \
	&& grep -qF '"scan": ["/titles"]' /root/nut/conf/nut.conf
RUN sed -i -e '/pyqt5/d' -e '/qt-range-slider/d' /root/nut/requirements.txt \
	&& ! grep -qiE 'pyqt5|qt-range-slider' /root/nut/requirements.txt

Other propagation fixes:

  • SHELL ["/bin/bash", "-euo", "pipefail", "-c"] so any future chained/piped RUN fails the build instead of returning the last command's status.
  • apt-get autoremoveapt-get -y autoremove (previously it aborted with "Need to get..."/prompt semantics rather than doing its job) plus apt-get clean and removal of apt lists.
  • test -f /root/nut/nut.py after extraction, so a changed archive layout fails at build time rather than as a container crash loop.
  • PYTHONUNBUFFERED=1 / PYTHONFAULTHANDLER=1: tracebacks and fatal signals are otherwise buffered away and lost from docker logs when the server dies.
  • HEALTHCHECK TCP-connects to 9000, so a dead or wedged server is reported instead of the container looking fine. --start-period=180s covers titledb loading (~90s observed).
  • wget -O /tmp/nut.zip --tries=3, unzip -q, --no-install-recommends, --no-cache-dir.

Verification

  • docker build succeeds; nut.conf contains "scan": ["/titles"].
  • Container reaches health=healthy after startup, logs Server Starts - 0.0.0.0:9000.
  • Negative test: a sed pattern that matches nothing now fails the build (exit code: 1) instead of passing silently.

Link to Devin session: https://app.devin.ai/sessions/166162ba454e4104bfe8ced74f39bb9a
Requested by: @eskwisit

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@eskwisit eskwisit self-assigned this Aug 12, 2026
@devin-ai-integration

Copy link
Copy Markdown
Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant