Skip to content

Fix Docker image: install NatureDataCubeR package#7

Open
kuytje wants to merge 1 commit into
LTER-LIFE:mainfrom
kuytje:fix/dockerfile-install-package
Open

Fix Docker image: install NatureDataCubeR package#7
kuytje wants to merge 1 commit into
LTER-LIFE:mainfrom
kuytje:fix/dockerfile-install-package

Conversation

@kuytje

@kuytje kuytje commented Jun 30, 2026

Copy link
Copy Markdown

Problem

The deployed app (e.g. https://lter-life-experience.org/naturedatacube) was crash-looping → 502 at the proxy. The container exits on startup with:

Error ... there is no package called 'NatureDataCubeR'
Execution halted

The image was built from the package layout, but the Dockerfile never actually installed the NatureDataCubeR package — and the app does library(NatureDataCubeR). The old COPY R/naturedatacube_app, COPY R/retrieval_functions, COPY data lines also referenced paths that no longer exist in the package layout (app moved to inst/shiny/, data to inst/extdata/).

Changes

  • Dockerfile: COPY the package source and R CMD INSTALL it, so library(NatureDataCubeR) and system.file() (Shiny app in inst/shiny, data in inst/extdata) resolve at runtime. Launch via the package's own ndc_shiny() launcher instead of a hardcoded /srv path. Drop the obsolete COPY lines.
  • .env.example: rename AGRO_DATA_TOKENADC_TOKEN to match app.R, which reads ADC_TOKEN and stop()s without it.
  • .dockerignore: keep .git/.env/tests out of the build context.

Verification

  • docker build succeeds; requireNamespace('NatureDataCubeR') is TRUE in the image and system.file(...) resolves the app + gpkg.
  • Container now boots past the package load (previously the fatal point); only the runtime ADC_TOKEN env check remains, which is host .env config.

🤖 Generated with Claude Code

The image was built from the package layout but never installed the
NatureDataCubeR package itself, so the app crash-looped at startup with
"there is no package called 'NatureDataCubeR'" (502 at the proxy).

- Dockerfile: COPY the package source and R CMD INSTALL it, so
  library(NatureDataCubeR) and system.file() (Shiny app in inst/shiny,
  data in inst/extdata) resolve at runtime. Launch via the package's
  own ndc_shiny() launcher instead of a hardcoded /srv path. Drop the
  obsolete COPY R/naturedatacube_app, R/retrieval_functions, data lines
  (those paths no longer exist in the package layout).
- .env.example: rename AGRO_DATA_TOKEN to ADC_TOKEN to match app.R,
  which reads ADC_TOKEN and stop()s without it.
- .dockerignore: keep .git/.env/tests out of the build context.

Verified: image builds, package installs, container boots past the
package load (now only the runtime token check remains).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant