3

I am relatively new to Docker concepts and I am trying to dockerize one of the Shinys app that I built.

Since I am working on Google analytics data One of the dependencies is from github repositories where I am using a package called rga. The link to repository is https://github.com/skardhamar/rga

Below is the Docker file which I have created following the article https://www.bjoern-hartmann.de/post/learn-how-to-dockerize-a-shinyapp-in-7-steps/

# Install R version 3.5
FROM r-base:3.5.0

# Install Ubuntu packages
RUN apt-get update && apt-get install -y \
    sudo \
    gdebi-core \
    pandoc \
    pandoc-citeproc \
    libcurl4-gnutls-dev \
    libcairo2-dev/unstable \
    libxt-dev \
    libssl-dev

# Download and install ShinyServer (latest version)
RUN wget --no-verbose https://s3.amazonaws.com/rstudio-shiny-server-os-build/ubuntu-12.04/x86_64/VERSION -O "version.txt" && \
    VERSION=$(cat version.txt)  && \
    wget --no-verbose "https://s3.amazonaws.com/rstudio-shiny-server-os-build/ubuntu-12.04/x86_64/shiny-server-$VERSION-amd64.deb" -O ss-latest.deb && \
    gdebi -n ss-latest.deb && \
    rm -f version.txt ss-latest.deb

# Install R packages that are required
# TODO: add further package if you need!
RUN R -e "install.packages(c('shiny', 'shinydashboard', 'dplyr', 'ggplot2', 'bigrquery', 'devtools'), repos='http://cran.rstudio.com/')"
RUN R -e "devtools::install_github('rga', 'skardhamar')"

# Copy configuration files into the Docker image
COPY shiny-server.conf  /etc/shiny-server/shiny-server.conf
COPY /app /srv/shiny-server/

# Make the ShinyApp available at port 80
EXPOSE 80

# Copy further configuration files into the Docker image
COPY shiny-server.sh /usr/bin/shiny-server.sh

CMD ["/usr/bin/shiny-server.sh"]

However, while trying to the build the docker image it throws an error as below

Error in parse_repo_spec(repo) : Invalid git repo specification: 'rga'
Calls: <Anonymous> -> lapply -> FUN -> parse_git_repo -> parse_repo_spec
Execution halted

when changed to

RUN R -e "devtools::install_github("rga", "skardhamar")"

It gives below error:

Error in lapply(repo, github_remote, ref = ref, subdir = subdir, auth_token = auth_token,  :
  object 'rga' not found
Calls: <Anonymous> -> lapply
Execution halted
halfer
  • 19,824
  • 17
  • 99
  • 186
Analytics_TM
  • 493
  • 6
  • 28

2 Answers2

1

I managed to solve this by using

RUN R -e "devtools::install_github('skardhamar/rga')"
Analytics_TM
  • 493
  • 6
  • 28
0

If is is a naming issue (as in here), you could try the CRAN version of that repository:

https://github.com/cran/RGA

So:

RUN R -e "devtools::install_github("RGA", "cran")"
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Thanks a lot for your response. I managed to solve it. Please see the below posted answer. However when I run the docker I get an error `The application failed to start.The application exited during initialization.`Any suggestions what could have caused the issue. I am also not sure where to look for the logs – Analytics_TM May 07 '19 at 05:30
  • @AnalyticsTeam Probably an incorrect interpretation of the parameters: https://www.rdocumentation.org/packages/devtools/versions/1.13.6/topics/install_github: the first one is indeed the repo name (`user/repo`). – VonC May 07 '19 at 06:27