Files
ht-docker-node/Dockerfile
Juergen Kunz c6ba400214 feat(nvm): Enable full nvm support in Docker builds and CI/CD workflows
- Add global nvm configuration in /etc/bash.bashrc (prepended before PS1 check)
- Create bash-with-nvm wrapper for Dockerfile RUN commands
- Add intelligent ENTRYPOINT for runtime nvm support
- Change default SHELL directive to use nvm wrapper
- nvm commands work directly in RUN without manual sourcing
- nvm commands work in CI/CD workflow bash -c scripts
- Maintain backward compatibility: npmci still available, ENV PATH preserved
- Non-bash shells fall back to ENV PATH (v20.12.2)
- Both interactive and non-interactive shells have full nvm access

Technical implementation:
- /etc/bash.bashrc: NVM init prepended before early return
- /usr/local/bin/bash-with-nvm: Build-time wrapper via SHELL directive
- /usr/local/bin/docker-entrypoint.sh: Runtime wrapper for bash -c detection
- ENV PATH fallback ensures non-bash compatibility

Tested:
- Dockerfile RUN: install, use, version switching
- Runtime bash -c: all nvm commands
- CI/CD workflows: .gitea context
- Backward compat: pnpm, npmci, ENV PATH
- Multi-stage builds, interactive shells
2025-10-26 10:35:42 +00:00

5.0 KiB