-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
59 lines (50 loc) · 1.88 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# get shiny server plus tidyverse packages image
FROM rocker/shiny-verse:latest
RUN mkdir -p /opt/services/shinyapp/src
WORKDIR /opt/services/shinyapp/src/
# system libraries
# Try to only install system libraries you actually need
# Package Manager is a good resource to help discover system deps
RUN apt-get update && apt-get install -y \
libcurl4-gnutls-dev \
libssl-dev
# add add-apt-repository capability
RUN apt -y install software-properties-common dirmngr apt-transport-https lsb-release ca-certificates
# Add the UbuntuGIS Unstable for proper depencies for `sf` R package
RUN add-apt-repository ppa:ubuntugis/ubuntugis-unstable
# dependencies for `sf` R package
RUN apt-get update && apt-get install -y \
libudunits2-dev \
libgdal-dev \
libgeos-dev \
libproj-dev
# install R packages required
# Change the packages list to suit your needs
# grabs pre-compiled binaries from Posit Package Manager
RUN R -e 'install.packages(c(\
"shiny", \
"shinydashboard", \
"shiny.i18n", \
"shinyWidgets", \
"shinyjs", \
"fresh", \
"maps", \
"leaflet", \
"DT", \
"leafgl", \
"rmapshaper", \
"mapview", \
"httpuv", \
"htmlwidgets", \
"shinythemes" \
), dependencies = TRUE)'
# need to install sf from cran
RUN R -e "install.packages('sf', type = 'source', repos = 'https://cran.r-project.org/')"
# need to install terra from cran
# fixes libproj.so.22: cannot open shared object file: No such file or directory when installing from CRAN source
RUN R -e "install.packages('terra', type = 'source', repos = 'https://cran.r-project.org/')"
# clean up
RUN rm -rf /tmp/downloaded_packages/ /tmp/*.rds
COPY . /opt/services/shinyapp/src
EXPOSE 8080
CMD R -e "shiny::runApp(appDir='shinyapp', port=8080, host='0.0.0.0')"