dockerize without renv

This commit is contained in:
2026-07-27 17:38:47 -04:00
parent 26a42b5844
commit 386b0bf02a
4 changed files with 29 additions and 94 deletions
+23 -70
View File
@@ -1,76 +1,29 @@
FROM rocker/shiny:4.5.2 AS renv-base
FROM rocker/shiny
WORKDIR /app
#RUN apt update && apt install -y \
# libicu-dev \
# libtiff-dev \
# libgdal-dev \
# libgeos-dev \
# libproj-dev \
# libudunits2-dev \
# libpq-dev \
# libxml2-dev \
# libcurl4-openssl-dev \
# libssl-dev \
# libharfbuzz-dev \
# libfribidi-dev \
# libfontconfig1-dev \
# libcairo2-dev \
# libfreetype6-dev
RUN apt-get update && apt-get install -y \
build-essential \
cmake \
libcurl4-openssl-dev \
libssl-dev \
libxml2-dev \
libgdal-dev \
libgeos-dev \
libproj-dev \
libudunits2-dev \
libpq-dev \
libfontconfig1-dev \
libfreetype6-dev \
libharfbuzz-dev \
libfribidi-dev \
libabsl-dev \
libpng-dev \
libjpeg-dev \
libtiff-dev \
git \
pandoc \
&& rm -rf /var/lib/apt/lists/*
RUN install2.r
RUN mkdir -p renv
COPY --chown=shiny:shiny renv.lock renv.lock
COPY --chown=shiny:shiny .Rprofile .Rprofile
COPY --chown=shiny:shiny renv/activate.R renv/activate.R
COPY --chown=shiny:shiny renv/settings.json renv/settings.json
RUN Rscript -e '\
options(repos = c(CRAN = "https://packagemanager.posit.co/cran/__linux__/noble/latest")); \
install.packages("pak", repos = "https://packagemanager.posit.co/cran/__linux__/noble/latest"); \
pak::pak(c("DBI", "DT", "ModelMetrics", "R6", "RColorBrewer", "RPostgres", "Rcpp", "S7", "SQUAREM", "askpass", "backports", "base64enc", "billboarder", "bit", "bit64", "blob", "broom", "bsicons", "bslib", "cachem", "callr", "caret", "cellranger", "classInt", "cli", "clipr", "clock", "commonmark", "config", "conflicted", "cpp11", "crayon", "crosstalk", "curl", "data.table", "dbplyr", "diagram", "digest", "dplyr", "dtplyr", "dygraphs", "e1071", "evaluate", "farver", "fastmap", "flexdashboard", "fontawesome", "forcats", "foreach", "fs", "future", "future.apply", "gargle", "generics", "ggplot2", "ggrepel", "ggtext", "globals", "glue", "googledrive", "googlesheets4", "gower", "gridExtra", "gridtext", "gtable", "hardhat", "haven", "highr", "hms", "htmltools", "htmlwidgets", "httpuv", "httr", "ids", "ipred", "isoband", "iterators", "jpeg", "jquerylib", "jsonlite", "kableExtra", "knitr", "labeling", "later", "lava", "lazyeval", "leaflet", "leaflet.providers", "lifecycle", "listenv", "litedown", "lubridate", "magrittr", "markdown", "memoise", "mime", "modelr", "numDeriv", "openssl", "otel", "pROC", "paletteer", "parallelly", "patchwork", "pillar", "pkgconfig", "plotly", "plyr", "png", "pool", "prettyunits", "prismatic", "processx", "prodlim", "progress", "progressr", "promises", "proxy", "ps", "purrr", "quarto", "ragg", "rappdirs", "raster", "readr", "readxl", "recipes", "rematch", "rematch2", "renv", "reprex", "reshape2", "rlang", "rmarkdown", "rnaturalearth", "rstudioapi", "rvest", "s2", "sass", "scales", "selectr", "sf", "shape", "shiny", "shinyBS", "shinyWidgets", "shinyjs", "sourcetools", "sp", "sparsevctrs", "stringi", "stringr", "svglite", "sys", "systemfonts", "terra", "textshaping", "tibble", "tidyr", "tidyselect", "tidyverse", "tigris", "timeDate", "timechange", "tinytex", "tzdb", "units", "utf8", "uuid", "vctrs", "viridis", "viridisLite", "vroom", "withr", "wk", "xfun", "xml2", "xtable", "xts", "yaml", "zoo"))'
RUN mkdir -p renv/.cache
ENV RENV_PATHS_CACHE=renv/.cache
ENV RENV_CONFIG_CACHE_SYMLINKS=FALSE
RUN R -s -e "renv::restore()"
FROM rocker/shiny:4.5.2
RUN apt-get update && apt-get install -y \
libcurl4 \
libssl3 \
libxml2 \
gdal-bin \
libgeos-c1v5 \
libproj25 \
libudunits2-0 \
libpq5 \
libfontconfig1 \
libfreetype6 \
libharfbuzz0b \
libfribidi0 \
libpng16-16 \
libtiff6 \
pandoc \
&& rm -rf /var/lib/apt/lists/*
RUN mkdir -p /srv/shiny-server/app
RUN chown -R shiny:shiny /srv/shiny-server/app
COPY --chown=shiny:shiny --from=renv-base /app/renv /srv/shiny-server/app/renv
COPY --chown=shiny:shiny --from=renv-base /app/.Rprofile /srv/shiny-server/app/.Rprofile
COPY --chown=shiny:shiny --from=renv-base /app/renv.lock /srv/shiny-server/app/renv.lock
COPY --chown=shiny:shiny app/dashboard.Rmd /srv/shiny-server/app/index.Rmd
COPY --chown=shiny:shiny app/queries.R /srv/shiny-server/app/
COPY --chown=shiny:shiny app/utils.R /srv/shiny-server/app/
COPY --chown=shiny:shiny app/config.yml /srv/shiny-server/app/
COPY --chown=shiny:shiny shiny-server.conf /etc/shiny-server/shiny-server.conf
COPY app/ /srv/shiny-server/
EXPOSE 3838
CMD ["/usr/bin/shiny-server"]
+6
View File
@@ -0,0 +1,6 @@
services:
shiny:
build: .
restart: unless-stopped
ports:
- "3838:3838"
-24
View File
@@ -1,24 +0,0 @@
version: '3.8'
services:
dashboard:
build:
context: .
dockerfile: Dockerfile
image: hurricane-dashboard:dev
ports:
- "3838:3838"
environment:
- APP_ENV=development
# volumes:
# - ./app/dashboard.Rmd:/srv/shiny-server/app/index.Rmd:ro
# - ./app/queries.R:/srv/shiny-server/app/queries.R:ro
# - ./app/utils.R:/srv/shiny-server/app/utils.R:ro
# - ./app/config.yml:/srv/shiny-server/app/config.yml:ro
restart: unless-stopped
networks:
- app-network
networks:
app-network:
driver: bridge
View File