I'm relatively new to RShiny, Golem and Docker. However, I've built a little analytics dashboard with the Golem framework that I'd like to deploy locally using Docker.
I have been able to successfully build an image, but can't seem to get the container to run properly. When I do so, the container initialises and then halts with the following error:
> options('shiny.port'=80,shiny.host='0.0.0.0');ShinyPlatform::run_app()
Error in loadNamespace(x) : there is no package called ‘ShinyPlatform’
Calls: loadNamespace -> withRestarts -> withOneRestart -> doWithOneRestart
Execution halted
If it's any help, the command I'm using to run is the following:
docker run shinytest2
I'm also working within the project folder relative to the Rshiny app (don't know if that's any help).
Details are that it uses the renv and golem frameworks, and a mix of CRAN and local packages. Below is the dockerfile I'm using currently, most of it was automatically produced using golem::add_dockerfile()
. The only lines that I've modified are the following :
RUN R -e 'install.packages("renv/local/LocalPackage1_0.1.0.tar.gz", repos= NULL, type = "source")'
RUN R -e 'install.packages("renv/local/ShinyPlatform_0.0.0.9000.tar.gz", repos = NULL, type = "source")'
The first above was to solve an error I was getting due to the LocalPackage1 not being found due to being housed in another folder. The second line was more of a trial I attempted, to see if I could do the same thing to solve the current error, no such luck so far, so I'm pretty sure it's wrong.
Here is the whole docker file:
FROM rocker/r-ver:4.1.1
RUN apt-get update && apt-get install -y git-core libcairo2-dev libcurl4-openssl-dev libgit2-dev libicu-dev libssl-dev libxml2-dev make pandoc pandoc-citeproc zlib1g-dev && rm -rf /var/lib/apt/lists/*
RUN echo "options(repos = c(CRAN = 'https://cran.rstudio.com/'), download.file.method = 'libcurl', Ncpus = 4)" >> /usr/local/lib/R/etc/Rprofile.site
RUN R -e 'install.packages("remotes")'
RUN Rscript -e 'remotes::install_version("magrittr",upgrade="never", version = "2.0.1")'
RUN Rscript -e 'remotes::install_version("glue",upgrade="never", version = "1.4.2")'
RUN Rscript -e 'remotes::install_version("processx",upgrade="never", version = "3.5.2")'
RUN Rscript -e 'remotes::install_version("testthat",upgrade="never", version = "3.1.0")'
RUN Rscript -e 'remotes::install_version("htmltools",upgrade="never", version = "0.5.2")'
RUN Rscript -e 'remotes::install_version("attempt",upgrade="never", version = "0.3.1")'
RUN Rscript -e 'remotes::install_version("shiny",upgrade="never", version = "1.7.1")'
RUN Rscript -e 'remotes::install_version("config",upgrade="never", version = "0.3.1")'
RUN Rscript -e 'remotes::install_version("spelling",upgrade="never", version = "2.2")'
RUN Rscript -e 'remotes::install_version("thinkr",upgrade="never", version = "0.15")'
RUN Rscript -e 'remotes::install_version("shinyWidgets",upgrade="never", version = "0.6.2")'
RUN Rscript -e 'remotes::install_version("shinydashboard",upgrade="never", version = "0.7.2")'
RUN Rscript -e 'remotes::install_version("renv",upgrade="never", version = "0.14.0")'
RUN Rscript -e 'remotes::install_version("readxl",upgrade="never", version = "1.3.1")'
RUN Rscript -e 'remotes::install_version("gt",upgrade="never", version = "0.3.1")'
RUN Rscript -e 'remotes::install_version("golem",upgrade="never", version = "0.3.1")'
RUN R -e 'install.packages("renv/local/LocalPackage1_0.1.0.tar.gz", repos= NULL, type = "source")'
RUN R -e 'install.packages("renv/local/ShinyPlatform_0.0.0.9000.tar.gz", repos = NULL, type = "source")'
RUN Rscript -e 'remotes::install_version("DT",upgrade="never", version = "0.19")'
RUN Rscript -e 'remotes::install_version("DBI",upgrade="never", version = "1.1.1")'
RUN Rscript -e 'remotes::install_version("data.table",upgrade="never", version = "1.14.0")'
RUN echo "options(repos = c(CRAN = 'https://cran.rstudio.com/'), download.file.method = 'libcurl', Ncpus = 4)" >> /usr/local/lib/R/etc/Rprofile.site
RUN mkdir /build_zone
ADD . /build_zone
WORKDIR /build_zone
RUN rm -rf /build_zone
EXPOSE 80
CMD R -e "options('shiny.port'=80,shiny.host='0.0.0.0');ShinyPlatform::run_app()"
Wondering if anyone might have any ideas as to why my container halts and can't seem to find the shiny app within it?
As mentioned, I'm quite new to both RShiny, Golem and Docker, so if I've left out any critical information, please let me know and I can update this post.