Add modular system package installation support
Implemented SYSTEM_PACKAGES environment variable for flexible system library installation: Key Features: - Users specify packages in .env: SYSTEM_PACKAGES="libopenslide0 libgdal-dev" - Packages installed during Docker build (secure, no runtime mounting) - Automatic rebuild detection when packages change - Documentation with common scientific computing packages Technical Implementation: - ARG SYSTEM_PACKAGES in Dockerfile with conditional apt-get install - Build argument passed from claude-docker.sh script - Clean package management with cache cleanup Benefits: - Secure: No system directory mounting required - Flexible: Users choose exactly what they need - Documented: Common packages listed in README - Clean: Packages baked into image, not mounted at runtime Tested successfully with OpenSlide: conda run -n prism python -c "import openslide"
This commit is contained in:
parent
70040a7444
commit
066233b03c
10
.env.example
10
.env.example
@ -13,6 +13,16 @@ TWILIO_TO_NUMBER=+0987654321
|
||||
# Optional: Custom conda installation (for academic/lab environments)
|
||||
# Example: CONDA_PREFIX=/vol/biomedic3/username/miniconda3
|
||||
CONDA_PREFIX=
|
||||
|
||||
# Optional: Additional conda directories (space-separated list)
|
||||
# Directories are mounted to the same path inside the container
|
||||
# Automatic detection:
|
||||
# - Paths with "*env*" are added to CONDA_ENVS_DIRS (for environments)
|
||||
# - Paths with "*pkg*" are added to CONDA_PKGS_DIRS (for package cache)
|
||||
# Example: CONDA_EXTRA_DIRS="/vol/biomedic3/username/.conda/envs /vol/biomedic3/username/conda_envs /vol/biomedic3/username/.conda/pkgs /vol/biomedic3/username/conda_pkgs /homes/username/.conda/envs"
|
||||
CONDA_EXTRA_DIRS=
|
||||
|
||||
# Optional: System packages to install in Docker container (space-separated)
|
||||
# Common scientific packages: libopenslide0 libgdal-dev libproj-dev libopencv-dev
|
||||
# Example: SYSTEM_PACKAGES="libopenslide0 libgdal-dev"
|
||||
SYSTEM_PACKAGES=
|
11
Dockerfile
11
Dockerfile
@ -12,6 +12,17 @@ RUN apt-get update && apt-get install -y \
|
||||
sudo \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Install additional system packages if specified
|
||||
ARG SYSTEM_PACKAGES=""
|
||||
RUN if [ -n "$SYSTEM_PACKAGES" ]; then \
|
||||
echo "Installing additional system packages: $SYSTEM_PACKAGES" && \
|
||||
apt-get update && \
|
||||
apt-get install -y $SYSTEM_PACKAGES && \
|
||||
rm -rf /var/lib/apt/lists/*; \
|
||||
else \
|
||||
echo "No additional system packages specified"; \
|
||||
fi
|
||||
|
||||
# Create a non-root user with matching host UID/GID
|
||||
ARG USER_UID=1000
|
||||
ARG USER_GID=1000
|
||||
|
50
README.md
50
README.md
@ -113,6 +113,12 @@ This workflow gives you:
|
||||
- Configurable via MCP integration
|
||||
- Optional - works without if Twilio not configured
|
||||
|
||||
### 🐍 Conda Integration
|
||||
- Supports custom conda installations (ideal for academic/lab environments)
|
||||
- Mounts conda directories to preserve original paths and configurations
|
||||
- Automatic environment variable configuration for seamless conda usage
|
||||
- Works with environments and package caches in non-standard locations
|
||||
|
||||
### 🗂️ Context Persistence
|
||||
- Maintains scratchpad.md files for project memory
|
||||
- Persistent across container sessions
|
||||
@ -181,7 +187,49 @@ claude-docker
|
||||
Rebuild when you:
|
||||
- Update your .env file with new credentials
|
||||
- Update the Claude Docker repository
|
||||
- Want to refresh the authentication files
|
||||
|
||||
### Conda Configuration
|
||||
|
||||
For custom conda installations (common in academic/lab environments), add these to your `.env` file:
|
||||
|
||||
```bash
|
||||
# Main conda installation
|
||||
CONDA_PREFIX=/vol/biomedic3/username/miniconda3
|
||||
|
||||
# Additional conda directories (space-separated)
|
||||
CONDA_EXTRA_DIRS="/vol/biomedic3/username/.conda/envs /vol/biomedic3/username/conda_envs /vol/biomedic3/username/.conda/pkgs /vol/biomedic3/username/conda_pkgs"
|
||||
```
|
||||
|
||||
**How it works:**
|
||||
- `CONDA_PREFIX`: Mounts your conda installation to the same path in container
|
||||
- `CONDA_EXTRA_DIRS`: Mounts additional directories and automatically configures conda
|
||||
|
||||
**Automatic Detection:**
|
||||
- Paths containing `*env*` → Added to `CONDA_ENVS_DIRS` (conda environment search)
|
||||
- Paths containing `*pkg*` → Added to `CONDA_PKGS_DIRS` (package cache search)
|
||||
|
||||
**Result:** All your conda environments and packages work exactly as they do on your host system.
|
||||
|
||||
### System Package Installation
|
||||
|
||||
For scientific computing packages that require system libraries, add them to your `.env` file:
|
||||
|
||||
```bash
|
||||
# Install OpenSlide for medical imaging
|
||||
SYSTEM_PACKAGES="libopenslide0"
|
||||
|
||||
# Install multiple packages (space-separated)
|
||||
SYSTEM_PACKAGES="libopenslide0 libgdal-dev libproj-dev libopencv-dev"
|
||||
```
|
||||
|
||||
**Common packages:**
|
||||
- `libopenslide0` - OpenSlide for whole slide imaging
|
||||
- `libgdal-dev` - GDAL for geospatial data
|
||||
- `libproj-dev` - PROJ for cartographic projections
|
||||
- `libopencv-dev` - OpenCV for computer vision
|
||||
- `libfftw3-dev` - FFTW for fast Fourier transforms
|
||||
|
||||
**Note:** Adding system packages requires rebuilding the Docker image (`docker rmi claude-docker:latest`).
|
||||
|
||||
## Requirements
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user