Dick Postma and Xavier EscribΓ Montagut
Goal: Build custom Rock server Docker images with specific DataSHIELD packages
Why custom images?
DataSHIELD provides base images:
datashield/rock-base:6.3-R4.3
- Minimal Rock server with R 4.3obiba/rock:latest
- Standard Rock just with resourcer
Naming convention: {dsBase-version}-R{R-version}
Example: 6.3-R4.3
= dsBase v6.3 + R v4.3
Basic template for custom Rock images:
FROM datashield/rock-base:6.3-R4.3
# Define package versions for reproducibility
ENV DSURVIVAL_VERSION v2.3.0-dev
# Rock library path
ENV ROCK_LIB /var/lib/rock/R/library
# Install DataSHIELD packages
RUN Rscript -e "remotes::install_github('datashield/dsSurvival', \
ref = '$DSURVIVAL_VERSION', lib = '$ROCK_LIB')"
# Fix ownership (Rock runs as non-root user)
RUN chown -R rock $ROCK_LIB
# Build with descriptive tag
docker build -f Dockerfile.survival -t rock-survival:v2.3.0 .
# Build with multiple tags
docker build -f Dockerfile.survival \
-t rock-survival:v2.3.0 \
-t rock-survival:latest \
.
Best practice: Always tag with version numbers!
Use semantic versioning:
Push to Docker Hub:
# Tag for your registry
docker tag rock-survival:v2.3.0 \
your-dockerhub-username/rock-survival:v2.3.0
# Push to registry
docker push your-dockerhub-username/rock-survival:v2.3.0
Pull on other systems:
β Achieved: Custom Rock server images with specific packages
π― Benefits: - Reproducible environments across deployments - Version-controlled package management - Team collaboration and sharing
π Ready for: Production deployment with consistent environments!