I've been using the Golem framework for building R Shiny applications, which has been extremely helpful but I'm struggling with the docker file creation aspect of the framework.
Workflow:
In RStudio I create a new golem package, and insert a MIT license (without a license I receive a warning in devtools::check())
Run devtools::check() # Check passes no error no warnings
Run golem::add_dockerfile() # Which creates a Dockerfile in the project root
Close RStudio and open folder in VScode (docker build fails through RStudio)
docker build -t test .
docker run --rm -p 3838:3838 test
I now see the following console output
R version 4.1.0 (2021-05-18) -- "Camp Pontanezen"
Copyright (C) 2021 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> options('shiny.port'=80,shiny.host='0.0.0.0');experimentdocker::run_app()
Loading required package: shiny
Listening on http://0.0.0.0:80
But when I navigate to http://0.0.0.0:80 I see "This page isn't working right now"
I'd really appreciate any support that can be offered.
I've included the standard golem dockerfile below.
FROM rocker/r-ver:4.1.0
RUN apt-get update && apt-get install -y git-core libcurl4-openssl-dev libgit2-dev libicu-dev libssl-dev libxml2-dev make pandoc pandoc-citeproc && 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("shiny",upgrade="never", version = "1.6.0")'
RUN Rscript -e 'remotes::install_version("config",upgrade="never", version = "0.3.1")'
RUN Rscript -e 'remotes::install_version("golem",upgrade="never", version = "0.3.1")'
RUN mkdir /build_zone
ADD . /build_zone
WORKDIR /build_zone
RUN R -e 'remotes::install_local(upgrade="never")'
RUN rm -rf /build_zone
EXPOSE 80
CMD R -e "options('shiny.port'=80,shiny.host='0.0.0.0');experimentdocker::run_app()"