Skip to content

Instantly share code, notes, and snippets.

@Martins6
Last active October 4, 2020 00:41
Show Gist options
  • Save Martins6/9319ac1aa8112d30dfa9a33c082d64fd to your computer and use it in GitHub Desktop.
Save Martins6/9319ac1aa8112d30dfa9a33c082d64fd to your computer and use it in GitHub Desktop.
Dockerfile for Shiny App with renv.lock to remake the environment automatically.
# get shiny serves plus tidyverse packages image
FROM rocker/shiny-verse:latest
# system libraries of general use
RUN apt-get update && apt-get install -y \
sudo \
pandoc \
pandoc-citeproc \
libcurl4-gnutls-dev \
libcairo2-dev \
libxt-dev \
libssl-dev \
libssh2-1-dev
## update system libraries
RUN apt-get update && \
apt-get upgrade -y && \
apt-get clean
# copy necessary files
## app folder
COPY /app ./app
## renv.lock file
COPY renv.lock ./renv.lock
# install renv & restore packages
RUN Rscript -e 'install.packages("renv")'
RUN Rscript -e 'renv::restore()'
# expose port
EXPOSE 3838
# run app on container start
CMD ["R", "-e", "shiny::runApp('/app', host = '0.0.0.0', port = 3838)"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment