Skip to content

Commit

Permalink
Further refinements
Browse files Browse the repository at this point in the history
  • Loading branch information
gowerc committed Sep 26, 2024
1 parent 80b394b commit c26ad27
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 2 deletions.
5 changes: 5 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,11 @@ To support CI/CD, in terms of reducing setup time, a Docker images has been crea

This image is automatically re-built once a month to contain the latest version of R and its packages. The code to create this images can be found in `misc/docker`.

To build the image locally run the following from the project root directory:
```
docker build -f misc/docker/Dockerfile -t rbmi:latest .
```


### Reproducibility, Print Tests & Snaps

Expand Down
4 changes: 2 additions & 2 deletions misc/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ RUN apt-get update -y --fix-missing && \
apt-get upgrade -y && \
apt-get install -y $REQD_PKGS

ADD install_packages.R /
ADD ../../DESCRIPTION /
ADD misc/docker/install_packages.R /
ADD DESCRIPTION /

RUN Rscript /install_packages.R

Expand Down
16 changes: 16 additions & 0 deletions misc/docker/install_packages.R
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,29 @@ if (!requireNamespace("desc", quietly = TRUE)) {
install.packages("desc")
}


# Get a list of all packages that we claim we depend on in the DESCRIPTION file
pkgs <- desc::desc("DESCRIPTION")$get_deps()$package |> unique()

# Add on additional packages that might be needed in the future
pkgs <- c(pkgs, "tidyverse")


# R will error if you try to update the base packages so remove them
# if they are in any of the imports / suggests / depends list
base_pkgs <- c(
"KernSmooth", "class", "foreign", "methods", "rpart", "survival",
"MASS", "cluster", "grDevices", "mgcv", "spatial", "tcltk",
"Matrix", "codetools", "graphics", "nlme", "splines", "tools",
"base", "compiler", "grid", "nnet", "stats", "translations",
"boot", "datasets", "lattice", "parallel", "stats4", "utils",
"R"
)
pkgs <- pkgs[!pkgs %in% base_pkgs]

install.packages(pkgs, dependencies = TRUE)

# Install cmdstanr (not available from CRAN)
install.packages(
"cmdstanr",
repos = c("https://stan-dev.r-universe.dev", getOption("repos"))
Expand Down

0 comments on commit c26ad27

Please sign in to comment.