Skip to content

Commit

Permalink
initial
Browse files Browse the repository at this point in the history
  • Loading branch information
gowerc committed Sep 26, 2024
1 parent 84df256 commit 8dc5fc9
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 124 deletions.
25 changes: 6 additions & 19 deletions .github/workflows/build_docker.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
name: Build fixed version Docker images
name: Build latest version Docker images

env:
REGISTRY: ghcr.io

on:
schedule:
- cron: '0 5 1 * *'
workflow_dispatch:


Expand All @@ -18,16 +20,7 @@ jobs:
matrix:
config:
- {
src_image: "rocker/r-ver:4.0.4",
cran_url: "https://packagemanager.rstudio.com/cran/2021-04-20",
tag: "rbmi:r404",
mmrm_version : "v0.1.5"
}
- {
src_image: "rocker/r-ver:4.1.0",
cran_url: "https://packagemanager.rstudio.com/cran/2021-08-04",
tag: "rbmi:r410",
mmrm_version : "v0.1.5"
tag: "rbmi:latest"
}

# Token permissions
Expand All @@ -37,8 +30,8 @@ jobs:

# Build steps
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Check out the repo
uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
Expand All @@ -64,9 +57,6 @@ jobs:
run: |
echo push = ${{ github.event_name == 'push' }}
echo tag = ${{ env.REGISTRY }}/${{ github.repository_owner }}/${{ matrix.config.tag }}
echo IMAGE=${{ matrix.config.src_image }}
echo CRANURL=${{ matrix.config.cran_url }}
echo MMRM_VERSION=${{ matrix.config.mmrm_version }}
- name: Build and push image
uses: docker/build-push-action@v3
Expand All @@ -75,9 +65,6 @@ jobs:
push: true
tags: ${{ env.REGISTRY }}/${{ github.repository_owner }}/${{ matrix.config.tag }}
build-args: |
IMAGE=${{ matrix.config.src_image }}
CRANURL=${{ matrix.config.cran_url }}
MMRM_VERSION=${{ matrix.config.mmrm_version }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new

Expand Down
85 changes: 0 additions & 85 deletions .github/workflows/build_docker_latest.yaml

This file was deleted.

6 changes: 1 addition & 5 deletions misc/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
ARG IMAGE

FROM ${IMAGE}

ARG CRANURL
ARG MMRM_VERSION
FROM rocker/r-ver:latest

ENV REQD_PKGS="\
libicu-dev \
Expand Down
47 changes: 32 additions & 15 deletions misc/docker/install_packages.R
Original file line number Diff line number Diff line change
@@ -1,32 +1,42 @@


OS_CODENAME <- system(
'cat /etc/os-release | grep "VERSION_CODENAME" | sed -e "s/VERSION_CODENAME=//"',
intern = TRUE
)

options(warn = 2)
CRANURL <- sprintf(
"https://packagemanager.posit.co/cran/__linux__/%s/latest",
OS_CODENAME
)

install.packages("remotes", repos = Sys.getenv("CRANURL"))
options(
"repos" = list("CRAN" = CRANURL),
"HTTPUserAgent" = sprintf(
"R/%s R (%s)",
getRversion(),
paste(getRversion(), R.version["platform"], R.version["arch"], R.version["os"])
)
)

# mmrm wasn't available when in-house servers locked their package versions
# and instead had v0.13 of mmrm patched in after the fact
# here we allow the build to specify "latest" to grab the latest version of mmrm
# or a specific named version from github
mmrm_version <- Sys.getenv("MMRM_VERSION")
if (mmrm_version == "latest") {
install.packages("mmrm", repos = Sys.getenv("CRANURL"), dependencies = TRUE)
} else {
remotes::install_git("https://github.com/openpharma/mmrm.git", ref = mmrm_version, upgrade = FALSE)
}
options(warn = 2)

pkgs <- c(
"tidyverse",
"glmmTMB",
"dplyr",
"purrr",
"tibble",
"lubridate",
"purrr",
"mvtnorm",
"devtools",
"rstan",
"rstantools",
"RcppParallel",
"Rcpp",
"knitr",
"R6",
"assertthat",
"rmarkdown",
"emmeans",
"covr",
"testthat",
Expand All @@ -38,4 +48,11 @@ pkgs <- c(
"R.rsp"
)

install.packages(pkgs, repos = Sys.getenv("CRANURL"), dependencies = TRUE)
install.packages(pkgs, dependencies = TRUE)

install.packages(
"cmdstanr",
repos = c("https://stan-dev.r-universe.dev", getOption("repos"))
)

cmdstanr::install_cmdstan(cores = 2)

0 comments on commit 8dc5fc9

Please sign in to comment.