diff --git a/.env.sample b/.env.sample index cb708a9..81959a1 100644 --- a/.env.sample +++ b/.env.sample @@ -11,6 +11,7 @@ PREPROCESS_DB_USERNAME= # username for the source database PREPROCESS_DB_PASSWORD= # password for the source database PREPROCESS_DB_CDM_SCHEMA= # Schema name in the database to connect the OMOP CDM to PREPROCESS_SUMMARISE_LEVEL=monthly # Level to summarise record counts at (monthly or quarterly) +PREPROCESS_BUILD_CORES=4 # Number of cores to use for make in docker build # Low-frequency replacement LOW_FREQUENCY_THRESHOLD=5 diff --git a/app/Dockerfile b/app/Dockerfile index b87de04..b8bd1eb 100644 --- a/app/Dockerfile +++ b/app/Dockerfile @@ -13,7 +13,7 @@ RUN install2.r --error --skipinstalled renv remotes && \ RUN R -e 'remotes::install_github("SAFEHR-data/omop-bundles")' # Install the app -RUN R -e 'remotes::install_local(".", dependencies = TRUE)' +RUN R -e 'devtools::install(".", dependencies = TRUE)' EXPOSE 3838 CMD ["R", "-e", "options('shiny.port'=3838, shiny.host='0.0.0.0'); omopcat::run_app()" ] diff --git a/docker-compose.yml b/docker-compose.yml index 2bc2a52..9e535a1 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -7,6 +7,7 @@ services: # Required for running on GAE HTTP_PROXY: ${HTTP_PROXY} HTTPS_PROXY: ${HTTPS_PROXY} + CORES: ${PREPROCESS_BUILD_CORES} image: omopcat_preprocessing:latest platform: linux/amd64 environment: diff --git a/preprocessing/Dockerfile b/preprocessing/Dockerfile index e277e02..9ecd684 100644 --- a/preprocessing/Dockerfile +++ b/preprocessing/Dockerfile @@ -1,13 +1,18 @@ FROM rocker/tidyverse:4.4.1 WORKDIR /pkg -ADD preprocessing . COPY preprocessing/renv.lock ./renv.lock +# Speed up building by setting make with multiple cores from env +ARG CORES +ENV MAKE="make -j${CORES}" + RUN install2.r --error --skipinstalled renv remotes && \ R -e 'renv::restore()' && \ rm -rf /tmp/downloaded_packages +ADD preprocessing . + RUN R -e 'remotes::install_local(path = ".", dependencies = TRUE)' CMD ["R", "-e", "omopcat.preprocessing::preprocess()"] diff --git a/public.env.sample b/public.env.sample index 1378e1d..fa3a946 100644 --- a/public.env.sample +++ b/public.env.sample @@ -11,7 +11,7 @@ PREPROCESS_DB_USERNAME= # username for the source database PREPROCESS_DB_PASSWORD= # password for the source database PREPROCESS_DB_CDM_SCHEMA= # Schema name in the database to connect the OMOP CDM to PREPROCESS_SUMMARISE_LEVEL=quarterly # Level to summarise record counts at (monthly or quarterly) - +PREPROCESS_BUILD_CORES=4 # Number of cores to use for make in docker build # Low-frequency replacement LOW_FREQUENCY_THRESHOLD=10 LOW_FREQUENCY_REPLACEMENT=5