generated from alexvannoy/ExampleRAPI
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
49 lines (43 loc) · 1.43 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
# Pull base image
ARG rversion=4.1.0
# Note to self: tidyverse includes devtools
FROM rocker/tidyverse:${rversion} as shinybase
LABEL image=shinybase
# Install debian package dependencies
RUN apt-get update -qq && apt-get -y --no-install-recommends install \
libxml2-dev \
libcairo2-dev \
libsqlite3-dev \
libmariadb-dev \
libpq-dev \
libssh2-1-dev \
libcurl4-openssl-dev \
libssl-dev \
libpng-dev \
libxt6
# Update system libraries
RUN apt-get update && \
apt-get upgrade -y && \
apt-get clean
# Install pinned versions of R package dependencies
RUN Rscript -e "install.packages('remotes')" \
&& Rscript -e "remotes::install_version('jsonlite', '1.7.2')" \
&& Rscript -e "remotes::install_version('R.utils', '2.10.1')" \
&& Rscript -e "remotes::install_version('usethis', '2.0.1')" \
&& Rscript -e "remotes::install_version('testthat', '3.0.2')" \
&& Rscript -e "remotes::install_version('shiny', '1.6.0')"
# Copy the directory into the base image
WORKDIR /
COPY . app
WORKDIR /app
# TODO: Figure out how to test shiny apps...
# Test the shiny app
# FROM shinybase as test
# LABEL image=test
# RUN mkdir scripts/results && (Rscript inst/server.R &) && sleep 2 && Rscript scripts/run_tests_docker.R
# Create the release image
FROM shinybase as release
LABEL image=release
WORKDIR /app/
EXPOSE 8888
CMD [ "R", "-e", "shiny::runApp(appDir = '.', host = '0.0.0.0', port = 8888, launch.browser = FALSE)" ]