Skip to content

Commit

Permalink
Merge pull request hms-dbmi-cellenics#340 from hms-dbmi-cellenics/use…
Browse files Browse the repository at this point in the history
…-virtualenv

switch to virtualenv
  • Loading branch information
alexvpickering authored Oct 27, 2023
2 parents b440cf9 + f33faf6 commit efdac82
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions pipeline-runner/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,6 @@ RUN Rscript restore_renv.R
# deactivate so that .libPaths used (set above)
RUN R -q -e "renv::deactivate()"

# install miniconda and geosketch
# clean conda
ENV RETICULATE_MINICONDA_PATH=/src/r-miniconda
RUN R -q -e "reticulate::install_miniconda()" && \
R -q -e "reticulate::conda_install('r-reticulate', c('geosketch==1.2', 'scanorama==1.7.3'), pip = TRUE)" && \
CONDA_PATH=$(R -q -s -e "cat(reticulate::conda_binary())") && \
$CONDA_PATH clean --force-pkgs-dirs -y

# use renv::snapshot() while R dependency updates are quick to build
COPY ./renv.lock .
RUN Rscript restore_renv.R
Expand All @@ -66,19 +58,22 @@ RUN Rscript check_package_licenses.R
# ---------------------------------------------------
FROM rocker/r-ver:4.2.2 AS common
WORKDIR /src/pipeline-runner
ENV RETICULATE_MINICONDA_PATH=/src/r-miniconda

# get source code and R packages
COPY --from=builder /src /src

# add renv library to .libPaths
ENV RENV_LIB=/src/lib
RUN echo ".libPaths(c('$RENV_LIB', .libPaths()))" >> $(R RHOME)/etc/Rprofile.site && \
echo "python3-pip" >> sysdeps_run.txt && \
echo "wget" >> sysdeps_run.txt && \
echo "python3-pip python3-venv python3-dev wget" >> sysdeps_run.txt && \
cat sysdeps_run.txt | xargs ./install_debian_packages.sh && \
rm -rf *

# install python packages in virtualenv
ENV WORKON_HOME=/src/.virtualenvs
RUN R -q -e "reticulate::virtualenv_create('r-reticulate')" && \
R -q -e "reticulate::virtualenv_install('r-reticulate', c('geosketch==1.2', 'scanorama==1.7.3'), pip_options='--no-cache-dir')"

# ---------------------------------------------------
# PRODUCTION BUILD
# ---------------------------------------------------
Expand Down

0 comments on commit efdac82

Please sign in to comment.