@@ -24,8 +24,27 @@ RUN apt-get update && apt-get -y upgrade && apt-get install -y --no-install-reco
2424 libglpk-dev \
2525 && apt-get -y autoremove
2626
27- RUN echo "r <- getOption('repos'); r['CRAN'] <- 'http://cran.us.r-project.org'; options(repos = r);" > ~/.Rprofile
28- RUN Rscript -e "install.packages(c('remotes', 'BiocManager'))"
27+ # NOTE: cloud.r-project.org (not a specific regional mirror like
28+ # cran.us.r-project.org) is CRAN's own canonical, actively-maintained,
29+ # HTTPS entry point - it automatically redirects to a working mirror near
30+ # the build server. A specific regional mirror over plain HTTP can and
31+ # does go offline/get decommissioned without much notice, which is a
32+ # genuine (not just transient) risk, not just an unlucky one-off.
33+ RUN echo "r <- getOption('repos'); r['CRAN'] <- 'https://cloud.r-project.org'; options(repos = r);" > ~/.Rprofile
34+ # install.packages() does NOT raise an error or give a non-zero exit code
35+ # just because a package failed to install - it only prints a warning, so
36+ # a transient mirror/network hiccup here would previously be cached by
37+ # Docker as a "successful" layer even though remotes/BiocManager were
38+ # never actually installed, surfacing as a confusing failure several
39+ # steps later (at remotes::install_local()) instead of right here. This
40+ # explicitly checks that both packages are actually present afterwards
41+ # and fails the build immediately and clearly if not.
42+ RUN Rscript -e '\
43+ install.packages(c("remotes", "BiocManager")); \
44+ missing_pkgs <- setdiff(c("remotes", "BiocManager"), rownames(installed.packages())); \
45+ if (length(missing_pkgs) > 0) { \
46+ stop("Failed to install: ", paste(missing_pkgs, collapse = ", ")) \
47+ }'
2948
3049# Copy package source code
3150WORKDIR /markeR
0 commit comments