Skip to content

Comments

feat: Add Dockerfile and enable NLTK dependency#53

Open
ryan-steed-usa wants to merge 2 commits intopetermg:mainfrom
ryan-steed-usa:docker-non-root
Open

feat: Add Dockerfile and enable NLTK dependency#53
ryan-steed-usa wants to merge 2 commits intopetermg:mainfrom
ryan-steed-usa:docker-non-root

Conversation

@ryan-steed-usa
Copy link

Summary

  • Added comprehensive Dockerfile to enable containerized deployment with proper user management, environment configuration, and dependency installation
  • Enabled CUDA library path configuration for proper GPU acceleration support
  • Uncommented and enabled punkt_tab NLTK tokenizer download to ensure proper text processing capabilities with 3.8.2+
  • Configured Gradio server settings including port, host, analytics, and sharing options
  • Implemented proper file ownership and path management within the container
  • Added Python virtual environment setup and dependency installation from requirements.txt
  • Set up proper user switching for security best practices in containerized environment
  • Included system package installation for ffmpeg support

NLTK reference: nltk/nltk#3293

Podman non-root example

I prefer to use rootless Podman with a non-root container user building like:

time podman build -t chatterbox-gradio --no-cache --build-arg="UID=123" --build-arg="GID=123" --build-arg="USER_HOME=/app" .

Run with persistent data:

touch ~/chatterbox-gradio-settings.json
podman run --rm -d --replace -p 127.0.0.1:7860:7860 -v chatterbox-gradio-cache:/app/.cache -v chatterbox-gradio-nltk-data:/app/nltk_data -v ~/chatterbox-gradio-settings.json:/app/settings.json -v ~/audio/output:/app/output --gpus all --name chatterbox-gradio localhost/chatterbox-gradio:latest

Docker root example

I've also tested using root within a Ubuntu 24.04 VM (CPU only). To build:

time docker build -t chatterbox-gradio --no-cache .

Run:

touch ~/chatterbox-gradio-settings.json
docker run --rm -d -p 127.0.0.1:7860:7860 -v chatterbox-gradio-cache:/root/.cache -v chatterbox-gradio-nltk-data:/root/nltk_data -v ~/chatterbox-gradio-settings.json:/app/settings.json -v ~/audio/output:/app/output --name chatterbox-gradio chatterbox-gradio:latest

- Added comprehensive Dockerfile to enable containerized deployment with proper user management, environment configuration, and dependency installation
- Enabled CUDA library path configuration for proper GPU acceleration support
- Uncommented and enabled punkt_tab NLTK tokenizer download to ensure proper text processing capabilities with 3.8.2+
- Configured Gradio server settings including port, host, analytics, and sharing options
- Implemented proper file ownership and path management within the container
- Added Python virtual environment setup and dependency installation from requirements.txt
- Set up proper user switching for security best practices in containerized environment
- Included system package installation for ffmpeg support
@ryan-steed-usa
Copy link
Author

Closes #55

- Replaced `addgroup --system --gid $GID app` with `groupadd --system --gid $GID app` to use the modern group management command
- Replaced `adduser --system --no-create-home --uid $UID --gid $GID --home $USER_HOME app` with `useradd --system --uid $UID --gid $GID --home $USER_HOME app` to use the modern user management command
- These changes update the Dockerfile to use POSIX-compliant alternatives that are more widely supported and maintain compatibility with current Linux distributions
- The functionality remains identical but uses more standard and reliable system commands for creating system groups and users
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