Skip to content

Commit

Permalink
optimize dep installation
Browse files Browse the repository at this point in the history
  • Loading branch information
rxu17 committed Oct 17, 2024
1 parent 3c2344d commit f412a80
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions scripts/references/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,19 +1,31 @@
FROM rstudio/r-base:4.0-bullseye

# Set working directory
WORKDIR /usr/local/src/myscripts

# Set environment variable for renv version
ENV RENV_VERSION 0.14.0
# RUN rm /etc/apt/apt.conf.d/default
RUN apt-get update -y && apt-get install -y dpkg-dev zlib1g-dev libssl-dev libffi-dev curl libcurl4-openssl-dev procps

# Update apt-get and install system dependencies
RUN apt-get update -y && \
apt-get install -y --no-install-recommends \
dpkg-dev zlib1g-dev libssl-dev libffi-dev \
libcurl4-openssl-dev curl procps && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

RUN R -e "install.packages('remotes', repos = c(CRAN = 'https://cloud.r-project.org'))"
RUN R -e "remotes::install_github('rstudio/renv@${RENV_VERSION}')"
# Install R packages including remotes and renv
RUN R -e "install.packages('remotes', repos = 'https://cloud.r-project.org')" && \
R -e "remotes::install_github('rstudio/renv', ref = '${RENV_VERSION}')" || true

# Install synapser with specific version
RUN R -e "remotes::install_version('synapser', version = '0.11.7', repos = c('http://ran.synapse.org', 'http://cran.fhcrc.org'))"

# Set Python environment variable for R
ENV PYTHON /usr/local/lib/R/site-library/PythonEmbedInR/bin/python3.6


# Copy the local project files into the container
COPY . .

RUN R -e "renv::restore()"
# Restore R environment with renv
RUN R -e "renv::restore()"

0 comments on commit f412a80

Please sign in to comment.