fix(dockerignore): exclude .Rprofile from the build context#12
Merged
Conversation
`.Rprofile` is a per-project R startup file that often references host-side state (`renv::activate()`, dev-only options, paths from the developer's machine) and has no business being copied into a production container — it can subtly change which library `R` picks up at startup and break the deterministic install carried out by `renv::restore()` or `uvr sync`. Adding it to the auto-generated `.dockerignore` aligns the renv backend with what the experimental uvr backend already does, and matches the spirit of the existing exclusions (`.Rproj.user`, `manifest.json`, `rsconnect/`).
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.
Summary
Adds
.Rprofileto the list of paths written to.dockerignorebycreate_dockerignore()(used byshiny2docker()).Why
.Rprofileis a per-project R startup file. In a typical dev setup itcontains things like
renv::activate(), dev-only options, and pathsthat point to the developer's machine. Copying it into a production
container changes the R startup behaviour silently — for instance, it
can override
.libPaths()and shadow the library thatrenv::restore()or
uvr syncjust populated, leading to packages being loaded from anon-existent host path inside the image.
Excluding it matches the spirit of the existing entries (
.Rproj.user,manifest.json,rsconnect/) and aligns with what the experimentaluvr backend (
shiny2docker_uvr()) already does in its variant of.dockerignore.Scope
R/shiny2docker.R(create_dockerignore)..dockerignoreis created, not itscontent; no test update needed.
Test plan
Rscript -e 'devtools::test()'— existing tests still pass.shiny2docker()on a project that has a.Rprofile,confirm the file is no longer copied into the image
(
docker build --no-cache .thendocker run --rm <img> ls -la /srv/shiny-server/.Rprofileshould report absent).