Skip to content

Commit

Permalink
adjust to install intto the system library
Browse files Browse the repository at this point in the history
  • Loading branch information
dfalbel committed May 24, 2023
1 parent 097b667 commit 2e08ee9
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 6 deletions.
16 changes: 13 additions & 3 deletions cpu/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,20 @@ ENV LANG C.UTF-8
ENV TZ UTC

RUN curl -Ls https://github.com/r-lib/rig/releases/download/latest/rig-linux-latest.tar.gz | sudo tar xz -C /usr/local && \
rig add ${R_VERSION} && \
rm -rf /var/lib/apt/lists/*
rig add ${R_VERSION} --without-pak && \
rm -rf /var/lib/apt/lists/* && \
rm -rf /tmp/rig && \
apt-get clean

RUN Rscript -e "file.copy('tmp/Rprofile.site', file.path(R.home(), 'etc', 'Rprofile.site'))"
# We want to install pak into the system library, so we don't do it with rig
RUN for inst in $(ls /opt/R/*/lib/R/bin/INSTALL); do \
sed -i '1s/^/#!\/bin\/bash\n/' ${inst}; \
done; \
versions="$(rig ls --json | grep '"name"' | sed 's/^.*\"name\": \"//' | sed 's/\",//')" && \
for ver in $versions; do \
R-${ver} -q -e \
'install.packages("pak", lib = .Library, repos = sprintf("https://r-lib.github.io/p/pak/%s/%s/%s/%s", "devel", .Platform$pkgType, R.Version()$os, R.Version()$arch))'; \
done

# Install openBLAS which is critical for torch performance
RUN apt-get update -qq && \
Expand Down
17 changes: 14 additions & 3 deletions cuda/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,18 @@ ENV LANG C.UTF-8
ENV TZ UTC

RUN curl -Ls https://github.com/r-lib/rig/releases/download/latest/rig-linux-latest.tar.gz | sudo tar xz -C /usr/local && \
rig add ${R_VERSION} && \
rm -rf /var/lib/apt/lists/*
rig add ${R_VERSION} --without-pak && \
rm -rf /var/lib/apt/lists/* && \
rm -rf /tmp/rig && \
apt-get clean

# We want to install pak into the system library, so we don't do it with rig
RUN for inst in $(ls /opt/R/*/lib/R/bin/INSTALL); do \
sed -i '1s/^/#!\/bin\/bash\n/' ${inst}; \
done; \
versions="$(rig ls --json | grep '"name"' | sed 's/^.*\"name\": \"//' | sed 's/\",//')" && \
for ver in $versions; do \
R-${ver} -q -e \
'install.packages("pak", lib = .Library, repos = sprintf("https://r-lib.github.io/p/pak/%s/%s/%s/%s", "devel", .Platform$pkgType, R.Version()$os, R.Version()$arch))'; \
done

RUN Rscript -e "file.copy('tmp/Rprofile.site', file.path(R.home(), 'etc', 'Rprofile.site'))"

0 comments on commit 2e08ee9

Please sign in to comment.