pharmaverse/admiralci

Create a PoC container image for `admiral` CI/CD and local development workflows

Closed this issue · 2 comments

Leverage the widely used rocker RStudio images as the base, and populate these with packages from the renv.lock file in this repo.

Blueprint for creating the admiralci image:

FROM rocker/rstudio:4.1.3
COPY renv.lock renv.lock
RUN <commands to install sysdeps>
RUN R -s -e 'renv::restore()'
ENTRYPOINT ["/init"] # This starts a new RStudio Server session locally

You will find some reference implementations in https://github.com/insightsengineering/ci-images

The docker file which I have been using:

# Start with R v4.0.5, RStudio Server and tidyverse.
FROM rocker/tidyverse:4.0.5

# Install additional Linux packages which are needed for package development.
RUN apt-get update && apt-get install -y \
    qpdf \ 
    libxt-dev

# Copy the admiral renv.lock file (from the GitHub development branch) into the image.
WORKDIR /project
ADD [https://raw.githubusercontent.com/pharmaverse/admiral/devel/renv.lock](https://urldefense.com/v3/__https:/raw.githubusercontent.com/pharmaverse/admiral/devel/renv.lock__;!!AoaiBx6H!ytuFqREsn4-UTeBEeZjqO1qdjlru6ZbhXNecdHY03N5VOGJcVdE7ASiuVibfjHHFiEY6y40TOICAAQ$) renv.lock

# Install the remotes package, which allows us to install packages from GitHub.
RUN R -e "install.packages('remotes', repos = c(CRAN = '[https://cloud.r-project.org](https://urldefense.com/v3/__https:/cloud.r-project.org__;!!AoaiBx6H!ytuFqREsn4-UTeBEeZjqO1qdjlru6ZbhXNecdHY03N5VOGJcVdE7ASiuVibfjHHFiEY6y41M5Tx3_g$)'))"

# Install renv from GitHub.
ENV RENV_VERSION 0.16.0  
RUN R -e "remotes::install_github('rstudio/renv@${RENV_VERSION}')"

# Pre-install all the packages as defined in the admiral renv.lock file from the devel branch.
ENV RENV_PATHS_LIBRARY renv/library
RUN R -e "renv::restore()"

# Pre-install the devel branch of the admiraldev and admiral.test packages.
RUN R -e "remotes::install_github('pharmaverse/admiraldev', ref = 'devel', dependencies = 'FALSE')"
RUN R -e "remotes::install_github('pharmaverse/admiral.test', ref = 'devel', dependencies = 'FALSE')"

RUN R -e "Sys.setenv('RENV_AUTOLOAD_ENABLED' = 'FALSE')"

# Port
EXPOSE 8787

The image is esimms999/admiral_405_dev
I have created a video of using this image in a GitHub Codespace. I just need to figure out how to share that video.

Video showing how to spin up the esimms999/admiral_405_dev image in GitHub Codespaces: https://youtu.be/5Y3uHevxNro