Fix Docker image: install NatureDataCubeR package#7
Open
kuytje wants to merge 1 commit into
Open
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
The image was built from the package layout, but the Dockerfile never actually installed the
NatureDataCubeRpackage — and the app doeslibrary(NatureDataCubeR). The oldCOPY R/naturedatacube_app,COPY R/retrieval_functions,COPY datalines also referenced paths that no longer exist in the package layout (app moved toinst/shiny/, data toinst/extdata/).Changes
COPYthe package source andR CMD INSTALLit, solibrary(NatureDataCubeR)andsystem.file()(Shiny app ininst/shiny, data ininst/extdata) resolve at runtime. Launch via the package's ownndc_shiny()launcher instead of a hardcoded/srvpath. Drop the obsoleteCOPYlines.AGRO_DATA_TOKEN→ADC_TOKENto matchapp.R, which readsADC_TOKENandstop()s without it..git/.env/testsout of the build context.Verification
docker buildsucceeds;requireNamespace('NatureDataCubeR')isTRUEin the image andsystem.file(...)resolves the app + gpkg.ADC_TOKENenv check remains, which is host.envconfig.🤖 Generated with Claude Code