@@ -19,17 +19,16 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
1919 libx11-dev \
2020 && rm -rf /var/lib/apt/lists/*
2121
22- # Layer 1: Core data manipulation packages (most stable)
23- RUN R -e "install.packages(c('dplyr', 'tidyr', 'data.table', 'magrittr'), repos='https://cran.rstudio.com/', dependencies=TRUE)"
24-
25- # Layer 2: Visualization packages (including Cairo for graphics output)
26- RUN R -e "install.packages(c('ggplot2', 'lattice', 'scales', 'Cairo'), repos='https://cran.rstudio.com/', dependencies=TRUE)"
27-
28- # Layer 3: Data I/O packages
29- RUN R -e "install.packages(c('readr', 'readxl', 'writexl', 'jsonlite', 'xml2'), repos='https://cran.rstudio.com/', dependencies=TRUE)"
30-
31- # Layer 4: Statistics and utilities
32- RUN R -e "install.packages(c('stats', 'MASS', 'survival', 'lubridate', 'stringr', 'glue'), repos='https://cran.rstudio.com/', dependencies=TRUE)"
22+ # Install all R packages in a single layer using Posit Package Manager
23+ # - amd64: Downloads pre-compiled binaries (~5 min)
24+ # - arm64: Compiles from source but single layer avoids redundant dependency builds
25+ RUN R -e "options(repos = c(CRAN = 'https://packagemanager.posit.co/cran/__linux__/bookworm/latest')); \
26+ install.packages(c( \
27+ 'dplyr', 'tidyr', 'data.table', 'magrittr', \
28+ 'ggplot2', 'lattice', 'scales', 'Cairo', \
29+ 'readr', 'readxl', 'writexl', 'jsonlite', 'xml2', \
30+ 'MASS', 'survival', 'lubridate', 'stringr', 'glue' \
31+ ))"
3332
3433# Create non-root user
3534RUN groupadd -g 1001 codeuser && \
0 commit comments