Files
ht-docker-tools/image_support_files/README.md
Juergen Kunz a15dc3f672 feat: restructure ht-docker-tools repository with enhanced Deno support and NVM integration
- Removed Dockerfile and added multiple Dockerfiles for various tools (ClickHouse, MongoDB, MinIO, Caddy, Redis) with Deno runtime.
- Updated package.json to reflect new repository structure and versioning.
- Added comprehensive README and technical notes for architecture overview and usage.
- Implemented build and test scripts for streamlined image creation and validation.
- Introduced bash scripts for NVM functionality in Docker images.
2025-11-27 13:10:00 +00:00

53 lines
1.6 KiB
Markdown

# Image Support Files
This directory contains helper scripts that enable NVM (Node Version Manager) functionality in Docker images.
## Files
### bash-with-nvm
A wrapper script used as the SHELL directive in Dockerfiles. It loads NVM before executing any RUN command, enabling commands like:
```dockerfile
SHELL ["/usr/local/bin/bash-with-nvm"]
RUN nvm install 18
RUN node --version
```
### docker-entrypoint.sh
An entrypoint script that ensures NVM is available at runtime. It handles:
1. Loading NVM environment on container start
2. Special handling for `bash -c` commands (common in CI/CD) to inject bashrc sourcing
## Usage
These files are copied into Alpine-based Docker images:
```dockerfile
COPY image_support_files/bash-with-nvm /usr/local/bin/bash-with-nvm
COPY image_support_files/docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh
RUN chmod +x /usr/local/bin/bash-with-nvm /usr/local/bin/docker-entrypoint.sh
SHELL ["/usr/local/bin/bash-with-nvm"]
ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]
```
## Why These Scripts Are Needed
NVM is a bash function, not a binary. This creates challenges in Docker:
1. **Build time**: Each RUN command starts a fresh shell without NVM loaded
2. **Runtime**: Container commands don't automatically have NVM available
3. **CI/CD**: Non-interactive shells (bash -c) need special handling
These scripts solve all three contexts.
## Maintenance
When updating NVM version, ensure compatibility with both scripts. The NVM_DIR path (`/usr/local/nvm`) must match across:
- These scripts
- Dockerfile ENV declarations
- /etc/bash.bashrc configuration