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:
Vishal Jain
2025-06-18 01:21:25 +01:00
parent 70040a7444
commit 066233b03c
3 changed files with 71 additions and 2 deletions

View File

@@ -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