-
Notifications
You must be signed in to change notification settings - Fork 11
/
Dockerfile.shiny
25 lines (17 loc) · 1.23 KB
/
Dockerfile.shiny
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
ARG BASE_IMAGE=provide-via-build-arg
FROM $BASE_IMAGE
# install shiny
RUN /usr/bin/R --no-save --slave -e "install.packages('shiny', clean=TRUE, quiet=TRUE)"
# on build, copy application files
ONBUILD COPY . /app
# on build, for installing additional dependencies etc.
ONBUILD RUN if [ -f "/app/onbuild" ]; then bash /app/onbuild; fi;
# on build, for backward compatibility, look for /app/Aptfile and if it exists, install the packages contained
ONBUILD RUN if [ -f "/app/Aptfile" ]; then export DEBIAN_FRONTEND=noninteractive && apt-get update -q && cat Aptfile | xargs apt-get -qy install && apt-get clean && rm -rf /var/lib/apt/lists/*; fi;
# on build, for backward compatibility, look for /app/init.R and if it exists, execute it
ONBUILD RUN if [ -f "/app/init.R" ]; then /usr/bin/R --no-init-file --no-save --slave -f /app/init.R; fi;
# on build, packrat restore packages
# NOTE: packrat itself is packaged in this same structure so will be bootstrapped here
ONBUILD RUN if [ -f "/app/packrat/init.R" ]; then /usr/bin/R --no-init-file --no-save --slave -f /app/packrat/init.R --args --bootstrap-packrat; fi;
# on build, renv restore packages
ONBUILD RUN if [ -f "/app/renv/activate.R" ]; then /usr/bin/R --no-save --slave -e 'renv::restore()'; fi;