rstudio / rstudio/packrat

packrat::restore() fails for Github package in Dockerfile

Open
#574 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
R
Stars
409
Forks
89
PR merge metrics
No merged PRs in 30d

Description

This line runs fine inside the Dockerfile:

devtools::install_github('nik01010/dashboardthemes', lib = '/root/shiny-planting-schedule/packrat/lib')

But if I try to packrat::restore() inside the Dockerfile I get an error when installing the above package from Github:

packrat::restore(project = '/root/shiny-planting-schedule')

Error:

Installing scales (1.0.0) ...
        OK (built source)
Installing dashboardthemes (1.0.5) ...
FAILED
Error in getSourceForPkgRecord(pkgRecord, srcDir(project), availablePackagesSource(repos = repos),  :
  Failed to download package from URL:
- 'https://api.github.com/repos/nik01010/dashboardthemes/tarball/91524951f8ac635c46711b7693bd468751ffb995'
Calls: <Anonymous> ... restoreImpl -> playActions -> installPkg -> getSourceForPkgRecord
Execution halted
The command '/bin/sh -c R -e "packrat::restore(project = '/root/shiny-planting-schedule')"' returned a non-zero code: 1

Here is the full Dockerfile:

# Install R version 3.6.1 with rstudio, tidyverse, and tex/publishing related packages
FROM rocker/verse:3.6.1

# Install Ubuntu packages
RUN apt-get update && apt-get install -y \
  sudo \
  gdebi-core \
  pandoc \
  pandoc-citeproc \
  libcurl4-gnutls-dev \
  libxml2-dev \
  libudunits2-dev \
  libcairo2-dev \
  libgdal-dev \
  libgeos-dev \
  libproj-dev \
  libxt-dev \
  libssl-dev

RUN mkdir /root/shiny-planting-schedule
RUN mkdir /root/shiny-planting-schedule/app
RUN mkdir /root/shiny-planting-schedule/packrat
RUN mkdir /root/shiny-planting-schedule/packrat/lib

COPY packrat /root/shiny-planting-schedule/packrat

RUN install2.r devtools \
  && rm -rf /tmp/downloaded_packages/ /tmp/*.rds

RUN R -e "devtools::install_github('rstudio/packrat')"

COPY packrat /root/shiny-planting-schedule/packrat

# Restore project packages with packrat
RUN R -e "packrat::restore(project = '/root/shiny-planting-schedule')"

# Copy app folder to image
COPY app /root/shiny-planting-schedule/app

# Make the ShinyApp available at port
EXPOSE 3838

CMD ["R", "-e", "setwd('root/shiny-planting-schedule'); source('/root/shiny-planting-schedule/app/source-file.R')"]

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the failure from the Dockerfile, comparing the successful devtools::install_github call with packrat::restore(project = '/root/shiny-planting-schedule'). Trace the restore path around the failed GitHub tarball URL; done means dashboardthemes installs successfully during the Docker build and the restore command exits successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, r
Domain
build-system, devops
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.