-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dockerfile
66 lines (54 loc) · 2.02 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
60
61
62
63
64
65
66
FROM rocker/shiny-verse:4.0.5
# system libraries of general use
## install debian packages
RUN apt-get update -qq && apt-get -y --no-install-recommends install \
file \
libedit2 \
libssl-dev \
lsb-release \
psmisc \
procps \
wget \
zlib1g-dev \
libxml2-dev \
libpq-dev \
libssh2-1-dev \
libcurl4-openssl-dev \
libssl-dev \
libmagick++-dev && \
rm -rf /var/lib/apt/lists/
## update system libraries
RUN apt-get update && \
apt-get upgrade -y && \
apt-get clean
# install miniconda, and set the appropriate path variables.
# install Python 3.7 (Miniconda) and Tensorflow Python packages then set path variables.
RUN wget --quiet https://repo.anaconda.com/miniconda/Miniconda3-py39_4.9.2-Linux-x86_64.sh -O ~/miniconda.sh && \
/bin/bash ~/miniconda.sh -b -p /opt/conda && \
rm ~/miniconda.sh && \
/opt/conda/bin/conda clean -tipsy && \
ln -s /opt/conda/etc/profile.d/conda.sh /etc/profile.d/conda.sh && \
echo ". /opt/conda/etc/profile.d/conda.sh" >> ~/.bashrc && \
echo "conda activate base" >> ~/.bashrc
ENV PATH /opt/conda/bin:$PATH
# install tensorflow and h5py using the pip that links to miniconda (the default pip is for python 2.7)
RUN /opt/conda/bin/conda install tensorflow keras pillow && \
/opt/conda/bin/conda clean -tipsy
# let R know the right version of python to use
ENV RETICULATE_PYTHON /opt/conda/bin/python
# install packages
RUN install2.r shinydashboard shinyalert waiter magick tippy httr shinyWidgets shinydisconnect shinyjs googledrive googlesheets4 keras noaaoceans
# create new user so it doesn't run as root
RUN groupadd -r shinyapp && useradd --no-log-init -r -g shinyapp shinyapp
# copy necessary files
ADD app.R /home/shinyapp/app.R
ADD models home/shinyapp/models
ADD keys home/shinyapp/keys
ADD text home/shinyapp/text
# change working directory
WORKDIR /home/shinyapp
# change to new 'shinyapp' user
USER shinyapp
EXPOSE 3838
# run app on container start
CMD ["R", "-e", "shiny::runApp('app.R', host = '0.0.0.0', port = 3838)"]