publishing with docker

This commit is contained in:
Andreas Gammelgaard Damsbo 2025-06-26 10:17:24 +02:00
parent 4c42636faa
commit 4f0a17d821
No known key found for this signature in database
20 changed files with 12040 additions and 68 deletions

49
.github/workflows/docker-build.yml vendored Normal file
View file

@ -0,0 +1,49 @@
name: Build and Push Docker Image
permissions:
contents: read
packages: write
on:
# push:
# branches:
# - main
# - master
release:
types: [published]
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Define lowercase variables
id: vars
run: |
REPO_OWNER_LOWER=$(echo "$GITHUB_REPOSITORY_OWNER" | tr '[:upper:]' '[:lower:]')
REPO_NAME_LOWER=$(echo "$GITHUB_REPOSITORY" | cut -d'/' -f2 | tr '[:upper:]' '[:lower:]')
echo "REPO_OWNER_LOWER=$REPO_OWNER_LOWER" >> $GITHUB_ENV
echo "REPO_NAME_LOWER=$REPO_NAME_LOWER" >> $GITHUB_ENV
- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
context: .
file: app_docker/Dockerfile
push: true
tags: |
ghcr.io/${{ env.REPO_OWNER_LOWER }}/${{ env.REPO_NAME_LOWER }}:latest
ghcr.io/${{ env.REPO_OWNER_LOWER }}/${{ env.REPO_NAME_LOWER }}:${{ github.sha }}

View file

@ -1002,19 +1002,6 @@ references:
email: russell-lenth@uiowa.edu
year: '2025'
doi: 10.32614/CRAN.package.emmeans
- type: software
title: visdat
abstract: 'visdat: Preliminary Visualisation of Data'
notes: Imports
url: https://docs.ropensci.org/visdat/
repository: https://CRAN.R-project.org/package=visdat
authors:
- family-names: Tierney
given-names: Nicholas
email: nicholas.tierney@gmail.com
orcid: https://orcid.org/0000-0003-1460-8722
year: '2025'
doi: 10.32614/CRAN.package.visdat
- type: software
title: styler
abstract: 'styler: Non-Invasive Pretty Printing of R Code'

View file

@ -79,7 +79,8 @@ Suggests:
testthat (>= 3.0.0),
shinytest,
covr,
cffr
cffr,
shiny2docker
URL: https://github.com/agdamsbo/FreesearchR, https://agdamsbo.github.io/FreesearchR/, https://app.FreesearchR.org/
BugReports: https://github.com/agdamsbo/FreesearchR/issues
VignetteBuilder: knitr

Binary file not shown.

View file

@ -11,11 +11,11 @@
|collate |en_US.UTF-8 |
|ctype |en_US.UTF-8 |
|tz |Europe/Copenhagen |
|date |2025-06-25 |
|date |2025-06-26 |
|rstudio |2025.05.0+496 Mariposa Orchid (desktop) |
|pandoc |3.6.4 @ /opt/homebrew/bin/ (via rmarkdown) |
|quarto |1.7.30 @ /usr/local/bin/quarto |
|FreesearchR |25.6.3.250625 |
|FreesearchR |25.6.3.250626 |
--------------------------------------------------------------------------------
@ -107,7 +107,6 @@
|htmltools |0.5.8.1 |2024-04-04 |CRAN (R 4.4.1) |
|htmlwidgets |1.6.4 |2023-12-06 |CRAN (R 4.4.0) |
|httpuv |1.6.16 |2025-04-16 |CRAN (R 4.4.1) |
|httr |1.4.7 |2023-08-15 |CRAN (R 4.4.0) |
|IDEAFilter |0.2.0 |2024-04-15 |CRAN (R 4.4.0) |
|insight |1.2.0 |2025-04-22 |CRAN (R 4.4.1) |
|iterators |1.0.14 |2022-02-05 |CRAN (R 4.4.1) |
@ -140,7 +139,6 @@
|opdisDownsampling |1.0.1 |2024-04-15 |CRAN (R 4.4.0) |
|openssl |2.3.2 |2025-02-03 |CRAN (R 4.4.1) |
|openxlsx2 |1.15 |2025-04-25 |CRAN (R 4.4.1) |
|pak |0.8.0.2 |2025-04-08 |CRAN (R 4.4.1) |
|parameters |0.24.2 |2025-03-04 |CRAN (R 4.4.1) |
|patchwork |1.3.0 |2024-09-16 |CRAN (R 4.4.1) |
|pbmcapply |1.5.1 |2022-04-28 |CRAN (R 4.4.1) |
@ -201,7 +199,6 @@
|sessioninfo |1.2.3 |2025-02-05 |CRAN (R 4.4.1) |
|shiny |1.10.0 |2024-12-14 |CRAN (R 4.4.1) |
|shinybusy |0.3.3 |2024-03-09 |CRAN (R 4.4.0) |
|shinydashboard |0.7.3 |NA |NA |
|shinyjs |2.1.0 |2021-12-23 |CRAN (R 4.4.0) |
|shinyTime |1.0.3 |2022-08-19 |CRAN (R 4.4.0) |
|shinyWidgets |0.9.0 |2025-02-21 |CRAN (R 4.4.1) |
@ -225,7 +222,8 @@
|uuid |1.2-1 |2024-07-29 |CRAN (R 4.4.1) |
|V8 |6.0.3 |2025-03-26 |CRAN (R 4.4.1) |
|vctrs |0.6.5 |2023-12-01 |CRAN (R 4.4.0) |
|visdat |0.6.0 |2023-02-02 |CRAN (R 4.4.0) |
|viridisLite |0.4.2 |2023-05-02 |CRAN (R 4.4.1) |
|visdat |0.6.0 |NA |NA |
|vroom |1.6.5 |2023-12-05 |CRAN (R 4.4.0) |
|withr |3.0.2 |2024-10-28 |CRAN (R 4.4.1) |
|writexl |1.5.4 |2025-04-15 |CRAN (R 4.4.1) |

6
app_docker/.dockerignore Normal file
View file

@ -0,0 +1,6 @@
.Rhistory
.git
.gitignore
manifest.json
rsconnect/
.Rproj.user

12
app_docker/Dockerfile Normal file
View file

@ -0,0 +1,12 @@
FROM rocker/geospatial:4.4.1
RUN apt-get update -y && apt-get install -y cmake make libcurl4-openssl-dev libicu-dev libssl-dev pandoc zlib1g-dev libsecret-1-dev libxml2-dev libx11-dev libcairo2-dev libfontconfig1-dev libfreetype6-dev libfribidi-dev libharfbuzz-dev libjpeg-dev libpng-dev libtiff-dev libfftw3-dev libsodium-dev && rm -rf /var/lib/apt/lists/*
RUN mkdir -p /usr/local/lib/R/etc/ /usr/lib/R/etc/
RUN echo "options(renv.config.pak.enabled = FALSE, repos = c(CRAN = 'https://cran.rstudio.com/'), download.file.method = 'libcurl', Ncpus = 4)" | tee /usr/local/lib/R/etc/Rprofile.site | tee /usr/lib/R/etc/Rprofile.site
RUN R -e 'install.packages("remotes")'
RUN R -e 'remotes::install_version("renv", version = "1.1.4")'
COPY renv.lock renv.lock
RUN --mount=type=cache,id=renv-cache,target=/root/.cache/R/renv R -e 'renv::restore()'
WORKDIR /srv/shiny-server/
COPY . /srv/shiny-server/
EXPOSE 3838
CMD R -e 'shiny::runApp("/srv/shiny-server",host="0.0.0.0",port=3838)'

11275
app_docker/app.R Normal file

File diff suppressed because it is too large Load diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

BIN
app_docker/www/favicon.ico Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

BIN
app_docker/www/favicon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

3
app_docker/www/favicon.svg Executable file

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 38 KiB

438
app_docker/www/intro.html Normal file

File diff suppressed because one or more lines are too long

31
app_docker/www/intro.md Normal file
View file

@ -0,0 +1,31 @@
# Welcome <img style="float: right;" src="FreesearchR-logo.png">
This is the ***FreesearchR*** data analysis tool. We intend ***FreesearchR*** to be a free tool for easy data evaluation and analysis. If you need more advanced tools, start with ***FreesearchR*** and then you'll probably be better off using *R* or similar directly.
Here is a brief summary of the functions:
1. **Import data** from a spreadsheet/file on your machine, direct export from a REDCap server, sample data or data from a your local environment if run locally.
1. **Data inspection** and **modification** like modifying variables or creating new (categorical from numeric or time data, or completely new variables from the data)
1. **Evaluate data** using descriptive analyses methods and inspect cross-correlations
1. **Create and export simple, clean plots** for data overview and insights
1. **Create regression simple models** for even more advanced data analyses
- Linear, dichotomous or ordinal logistic regression will be used depending on specified outcome variable
- Plot regression analysis coefficients
- Evaluate model assumptions
1. **Export results**
- Descriptive and regression analyses results for MS Word or [LibreOffice](https://www.libreoffice.org/)
- Modified data with preserved metadata
- Code to recreate all steps locally
The full [project documentation is here](https://agdamsbo.github.io/FreesearchR/) where you'll find detailed description of the app and link to the source code! If you want to [share feedback, please follow this link to a simple survey](https://redcap.au.dk/surveys/?s=JPCLPTXYDKFA8DA8).

View file

@ -0,0 +1,11 @@
@book{andreasgammelgaarddamsbo2025,
title = {agdamsbo/FreesearchR: FreesearchR 25.4.3},
author = {Damsbo, Andreas Gammelgaard},
year = {2025},
month = {04},
date = {2025-04-24},
publisher = {Zenodo},
doi = {10.5281/ZENODO.14527429},
url = {https://zenodo.org/doi/10.5281/zenodo.14527429}
}

83
app_docker/www/report.rmd Normal file
View file

@ -0,0 +1,83 @@
---
title: "FreesearchR data report"
date: "Report generated `r gsub('(\\D)0', '\\1', format(Sys.time(), '%A, %d.%m.%Y'))`"
format: docx
author: FreesearchR data analysis tool
toc: false
params:
data.file: NA
version: NA
regression.p: NA
---
```{r setup, echo = FALSE}
knitr::opts_chunk$set(echo = FALSE, message = FALSE, warning = FALSE)
# glue::glue("{format(lubridate::today(),'%A')}, {lubridate::day(lubridate::today())}.{lubridate::month(lubridate::today())}.{lubridate::year(lubridate::today())}")
```
```{r}
web_data <- readr::read_rds(file = params$data.file)
# web_data <- readr::read_rds(file = "~/FreesearchR/inst/apps/FreesearchR/www/web_data.rds")
library(gtsummary)
library(gt)
tbl_merge <- function(data) {
if (is.null(names(data))) {
data |> gtsummary::tbl_merge()
} else {
data |> gtsummary::tbl_merge(tab_spanner = names(data))
}
}
vec2sentence <- function(data, sep.word = "and") {
sep.word <- paste0(" ", gsub(" ", "", sep.word), " ")
if (length(data) < 2) {
out <- data
} else if (length(data) == 2) {
out <- paste(data, collapse = sep.word)
} else {
out <- paste(paste(data[-length(data)], collapse = ","), data[length(data)], sep = sep.word)
}
return(out)
}
```
## Introduction
Research should be free and open with easy access for all. The *FreesearchR* tool attempts to help lower the bar to participate in research by making basic data exploration and analyses easily accessible.
## Methods
Analyses were conducted using the *FreesearchR* data analysis web-tool version `r params$version` based on *R* version 4.4.1.
## Results
Below are the baseline characteristics.
```{r, results = 'asis'}
if ("table1" %in% names(web_data)) {
tbl <- gtsummary::as_gt(web_data$table1)
knitr::knit_print(tbl)
}
```
`r if (length(web_data$regression) > 0) glue::glue("Below are the results from the { tolower(vec2sentence(names(web_data$regression$regression$tables)))} {web_data$regression$regression$params$descr}.")`
```{r, results = 'asis'}
if ("regression" %in% names(web_data) && length(web_data$regression) > 0) {
reg_tbl <- web_data$regression$regression$tables
merged <- tbl_merge(reg_tbl)
if (params$regression.p == "no") {
merged <- merged |>
gtsummary::modify_column_hide(column = dplyr::starts_with("p.value"))
}
knitr::knit_print(merged)
}
```
## Discussion
Good luck on your further work!

125
app_docker/www/style.css Normal file
View file

@ -0,0 +1,125 @@
/*!
* Copyright (c) 2025 FreesearchR
*
* FreesearchR, CSS styles
* https://github.com/agdamsbo/FreesearchR
*
* @version 0.0.1
*/
.container-fluid > .nav > li >
a[data-value='FreesearchR'] {font-size: 28px}
/* from datamods */
.show-block {
display: block !important;
}
.show-inline {
display: inline !important;
}
.hidden {
display: none !important;
}
.invisible {
visibility: hidden;
}
.container-rule {
position: relative;
text-align: center;
height: 25px;
margin-bottom: 5px;
}
.horizontal-rule {
position: absolute;
top: 11px;
right: 0;
left: 0;
background-color: #d0cfcf;
height: 1px;
z-index: 100;
margin: 0;
border: none;
}
.label-rule {
background: #FFF;
opacity: 1;
z-index: 101;
background-color: #FFF;
position: relative;
padding: 0 10px 0 10px;
}
.datamods-table-container {
overflow: auto;
word-break: keep-all;
white-space: nowrap;
}
.datamods-table-container > .table {
margin-bottom: 0 !important;
}
.datamods-file-import {
display: grid;
grid-template-columns: auto 50px;
grid-column-gap: 10px;
}
.datamods-dt-nowrap {
word-break: keep-all;
white-space: nowrap;
}
/* validation */
.datamods-validation-results {
display: grid;
grid-template-columns: repeat(3, 1fr);
grid-template-rows: 1fr;
height: 50px;
line-height: 50px;
font-size: large;
}
.datamods-validation-summary {
font-weight: bold;
text-align: center;
}
.datamods-validation-item {
font-size: larger;
}
/* modified from esquisse for data types */
.btn-column-categorical {
background-color: #00C896;
color: #FFFFFF;
}
.btn-column-continuous {
background-color: #FFB100;
color: #FFFFFF;
}
.btn-column-dichotomous {
background-color: #8A4FFF;
color: #FFFFFF;
}
.btn-column-datetime {
background-color: #11A0EC;
color: #FFFFFF;
}
.btn-column-id {
background-color: #848484;
color: #FFFFFF;
}
.btn-column-text {
background-color: #2E2E2E;
color: #FFFFFF;
}

View file

@ -0,0 +1 @@
<script defer src="https://stats.freesearchr.org/script.js" data-website-id="63976000-9836-45bc-90da-37ec5717fb22"></script>

BIN
app_docker/www/web_data.rds Normal file

Binary file not shown.

View file

@ -8917,54 +8917,6 @@
"Author": "Simon Garnier [aut, cre], Noam Ross [ctb, cph], Bob Rudis [ctb, cph], Marco Sciaini [ctb, cph], Antônio Pedro Camargo [ctb, cph], Cédric Scherer [ctb, cph]",
"Repository": "CRAN"
},
"visdat": {
"Package": "visdat",
"Version": "0.6.0",
"Source": "Repository",
"Title": "Preliminary Visualisation of Data",
"Authors@R": "c( person(\"Nicholas\", \"Tierney\", role = c(\"aut\", \"cre\"), email = \"nicholas.tierney@gmail.com\", comment = c(ORCID = \"https://orcid.org/0000-0003-1460-8722\")), person(\"Sean\", \"Hughes\", role = \"rev\", comment =c(ORCID = \"https://orcid.org/0000-0002-9409-9405\", \"Sean Hughes reviewed the package for rOpenSci, see https://github.com/ropensci/onboarding/issues/87\")), person(\"Mara\", \"Averick\", role = \"rev\", comment = \"Mara Averick reviewed the package for rOpenSci, see https://github.com/ropensci/onboarding/issues/87\"), person(\"Stuart\", \"Lee\", role = c(\"ctb\")), person(\"Earo\", \"Wang\", role = c(\"ctb\")), person(\"Nic\", \"Crane\", role = c(\"ctb\")), person(\"Christophe\", \"Regouby\", role=c(\"ctb\")) )",
"Description": "Create preliminary exploratory data visualisations of an entire dataset to identify problems or unexpected features using 'ggplot2'.",
"Depends": [
"R (>= 3.2.2)"
],
"License": "MIT + file LICENSE",
"LazyData": "true",
"RoxygenNote": "7.2.3",
"Imports": [
"ggplot2",
"tidyr",
"dplyr",
"purrr",
"readr",
"magrittr",
"stats",
"tibble",
"glue",
"forcats",
"cli",
"scales"
],
"URL": "https://docs.ropensci.org/visdat/, https://github.com/ropensci/visdat",
"BugReports": "https://github.com/ropensci/visdat/issues",
"Suggests": [
"testthat (>= 3.0.0)",
"plotly (>= 4.5.6)",
"knitr",
"rmarkdown",
"vdiffr",
"spelling",
"covr",
"stringr"
],
"VignetteBuilder": "knitr",
"Encoding": "UTF-8",
"Language": "en-US",
"Config/testthat/edition": "3",
"NeedsCompilation": "no",
"Author": "Nicholas Tierney [aut, cre] (<https://orcid.org/0000-0003-1460-8722>), Sean Hughes [rev] (<https://orcid.org/0000-0002-9409-9405>, Sean Hughes reviewed the package for rOpenSci, see https://github.com/ropensci/onboarding/issues/87), Mara Averick [rev] (Mara Averick reviewed the package for rOpenSci, see https://github.com/ropensci/onboarding/issues/87), Stuart Lee [ctb], Earo Wang [ctb], Nic Crane [ctb], Christophe Regouby [ctb]",
"Maintainer": "Nicholas Tierney <nicholas.tierney@gmail.com>",
"Repository": "CRAN"
},
"vroom": {
"Package": "vroom",
"Version": "1.6.5",