Skip to content

Commit

Permalink
feat: add deployment and docker
Browse files Browse the repository at this point in the history
  • Loading branch information
jimbrig committed Jun 21, 2024
1 parent c666e3e commit e4d9078
Show file tree
Hide file tree
Showing 9 changed files with 670 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,6 @@ $run_dev.*
^\.Renviron$
^\.Rprofile$
^config\.yml$
^build$
^Dockerfile$
^\.dockerignore$
7 changes: 7 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.RData
.Rhistory
.git
.gitignore
manifest.json
rsconnect/
.Rproj.user
20 changes: 20 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
FROM rocker/verse:4.4.1
RUN apt-get update && apt-get install -y && rm -rf /var/lib/apt/lists/*
RUN mkdir -p /usr/local/lib/R/etc/ /usr/lib/R/etc/
RUN echo "options(repos = c(CRAN = 'https://cran.rstudio.com/'), download.file.method = 'libcurl', Ncpus = 4)" | tee /usr/local/lib/R/etc/Rprofile.site | tee /usr/lib/R/etc/Rprofile.site
RUN R -e 'install.packages("remotes")'
RUN Rscript -e 'remotes::install_version("pkgload",upgrade="never", version = "1.3.4")'
RUN Rscript -e 'remotes::install_version("knitr",upgrade="never", version = "1.47")'
RUN Rscript -e 'remotes::install_version("shiny",upgrade="never", version = "1.8.1.1")'
RUN Rscript -e 'remotes::install_version("config",upgrade="never", version = "0.3.2")'
RUN Rscript -e 'remotes::install_version("testthat",upgrade="never", version = "3.2.1.1")'
RUN Rscript -e 'remotes::install_version("spelling",upgrade="never", version = "2.3.0")'
RUN Rscript -e 'remotes::install_version("rmarkdown",upgrade="never", version = "2.27")'
RUN Rscript -e 'remotes::install_version("golem",upgrade="never", version = "0.4.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');library(rshinycloudrun);rshinycloudrun::run_app()"
8 changes: 8 additions & 0 deletions build/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
*
!.gitignore
!Dockerfile
!Dockerfile_base
!README.md
!renv.lock.prod
!renv.lock
!compose.yml
8 changes: 8 additions & 0 deletions build/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FROM shinyexample_base
COPY renv.lock.prod renv.lock
RUN R -e 'renv::restore()'
COPY shinyexample_*.tar.gz /app.tar.gz
RUN R -e 'remotes::install_local("/app.tar.gz",upgrade="never")'
RUN rm /app.tar.gz
EXPOSE 80
CMD R -e "options('shiny.port'=80,shiny.host='0.0.0.0');library(shinyexample);shinyexample::run_app()"
8 changes: 8 additions & 0 deletions build/Dockerfile_base
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FROM rocker/r-ver:latest:4.4.1
RUN apt-get update -y && apt-get install -y make zlib1g-dev git && rm -rf /var/lib/apt/lists/*
RUN mkdir -p /usr/local/lib/R/etc/ /usr/lib/R/etc/
RUN echo "options(renv.config.pak.enabled = FALSE, repos = c(CRAN = 'https://cran.rstudio.com/'), download.file.method = 'libcurl', Ncpus = 4)" | tee /usr/local/lib/R/etc/Rprofile.site | tee /usr/lib/R/etc/Rprofile.site
RUN R -e 'install.packages("remotes")'
RUN R -e 'remotes::install_version("renv", version = "1.0.3")'
COPY renv.lock.prod renv.lock
RUN R -e 'renv::restore()'
Loading

0 comments on commit e4d9078

Please sign in to comment.