Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.git
.gitignore
.env
.Rproj.user
.Rhistory
.RData
tests/
README.md
LICENSE
2 changes: 1 addition & 1 deletion .env.example
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
NDC_TOKEN=your_token_here
AGRO_DATA_TOKEN=gettokenat_https://ndc-test.containers.wur.nl
ADC_TOKEN=gettokenat_https://ndc-test.containers.wur.nl
SHINY_APP_BASE_URL=/naturedatacube
71 changes: 38 additions & 33 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,33 +1,38 @@
# Use a base image with R and Shiny
FROM rocker/shiny:latest

# Install system libraries needed by some R packages
RUN apt-get update && apt-get install -y \
libcurl4-openssl-dev \
libxml2-dev \
libssl-dev \
libgeos-dev \
libgdal-dev \
libproj-dev \
libudunits2-dev \
&& rm -rf /var/lib/apt/lists/*

# Install required R packages (leaflet.extras from GitHub — not on CRAN for R 4.5+)
RUN R -e "install.packages(c( \
'shiny', 'leaflet', 'sf', 'dplyr', 'purrr', \
'stringr', 'httr', 'geojsonsf', 'jsonlite', 'zip', 'here', 'terra', \
'lubridate', 'tools', 'tibble', 'shinyjs', 'rstac', 'remotes' \
), repos='https://packagemanager.posit.co/cran/__linux__/noble/latest')" && \
R -e "remotes::install_github('bhaskarvk/leaflet.extras')"

# Copy app code and data — retrieval_functions must land inside the app dir
# so that here::here() resolves paths correctly at runtime
COPY R/naturedatacube_app /srv/shiny-server/naturedatacube_app
COPY R/retrieval_functions /srv/shiny-server/naturedatacube_app/R/retrieval_functions
COPY data /srv/shiny-server/naturedatacube_app/data

# Expose the port Shiny uses
EXPOSE 3838

# Command to run the app
CMD ["R", "-e", "shiny::runApp('/srv/shiny-server/naturedatacube_app', host='0.0.0.0', port=3838)"]
# Use a base image with R and Shiny
FROM rocker/shiny:latest

# Install system libraries needed by some R packages
RUN apt-get update && apt-get install -y \
libcurl4-openssl-dev \
libxml2-dev \
libssl-dev \
libgeos-dev \
libgdal-dev \
libproj-dev \
libudunits2-dev \
&& rm -rf /var/lib/apt/lists/*

# Install required R packages (leaflet.extras from GitHub — not on CRAN for R 4.5+).
# DESCRIPTION has no Imports field, so the package's dependencies are installed
# explicitly here rather than resolved by R CMD INSTALL.
RUN R -e "install.packages(c( \
'shiny', 'leaflet', 'sf', 'dplyr', 'purrr', \
'stringr', 'httr', 'geojsonsf', 'jsonlite', 'zip', 'here', 'terra', \
'lubridate', 'tools', 'tibble', 'shinyjs', 'rstac', 'remotes' \
), repos='https://packagemanager.posit.co/cran/__linux__/noble/latest')" && \
R -e "remotes::install_github('bhaskarvk/leaflet.extras')"

# Install the NatureDataCubeR package itself. This puts the Shiny app
# (inst/shiny/naturedatacube_app) and bundled data (inst/extdata) on the
# package's installed path, so library(NatureDataCubeR) and
# system.file(...) resolve at runtime.
COPY . /tmp/NatureDataCubeR
RUN R CMD INSTALL --no-multiarch --with-keep.source /tmp/NatureDataCubeR \
&& rm -rf /tmp/NatureDataCubeR

# Expose the port Shiny uses
EXPOSE 3838

# Launch the app via the package's own launcher, which locates the app dir
# with system.file(). SHINY_APP_BASE_URL (from .env) sets the proxy path.
CMD ["R", "-e", "NatureDataCubeR::ndc_shiny(host='0.0.0.0', port=3838)"]