-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
101 lines (86 loc) · 3.13 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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
FROM ubuntu:xenial
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
software-properties-common \
ed \
less \
locales \
vim-tiny \
wget \
ca-certificates \
apt-transport-https \
&& apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9 \
&& add-apt-repository 'deb https://cloud.r-project.org/bin/linux/ubuntu xenial-cran35/' \
&& add-apt-repository -y "ppa:marutter/rrutter" \
&& add-apt-repository -y "ppa:marutter/c2d4u3.5" \
# sf intricate stuff see package docs on github.
&& add-apt-repository ppa:ubuntugis/ubuntugis-unstable \
&& apt-get update
## Configure default locale, see https://github.com/rocker-org/rocker/issues/19
RUN echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen \
&& locale-gen en_US.utf8 \
&& /usr/sbin/update-locale LANG=en_US.UTF-8
## Now install R and littler, and create a link for littler in /usr/local/bin
## Default CRAN repo is now set by R itself, and littler knows about it too
## r-cran-docopt is not currently in c2d4u so we install from source
## Note: we need wget as the build env is too old for libcurl (we think, precise was)
RUN apt-get install -y --no-install-recommends \
r-cran-littler \
r-base \
r-base-dev \
r-recommended \
&& echo 'options(repos = c(CRAN = "https://cran.rstudio.com/"), download.file.method = "wget")' >> /etc/R/Rprofile.site \
&& ln -s /usr/lib/R/site-library/littler/examples/install.r /usr/local/bin/install.r \
&& ln -s /usr/lib/R/site-library/littler/examples/install2.r /usr/local/bin/install2.r \
&& ln -s /usr/lib/R/site-library/littler/examples/installGithub.r /usr/local/bin/installGithub.r \
&& ln -s /usr/lib/R/site-library/littler/examples/testInstalled.r /usr/local/bin/testInstalled.r \
&& install.r docopt \
&& rm -rf /tmp/downloaded_packages/ /tmp/*.rds
ENV LC_ALL en_US.UTF-8
ENV LANG en_US.UTF-8
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
lbzip2 \
libfftw3-dev \
libgdal-dev \
libgeos-dev \
libgsl0-dev \
libgl1-mesa-dev \
libglu1-mesa-dev \
libhdf4-alt-dev \
libhdf5-dev \
liblwgeom-dev \
libproj-dev \
libprotobuf-dev \
libnetcdf-dev \
libsqlite3-dev \
libssl-dev \
libudunits2-dev \
netcdf-bin \
tk-dev \
unixodbc-dev \
libv8-dev \
protobuf-compiler \
git
RUN apt-get install -y --no-install-recommends \
r-cran-sf r-cran-plumber r-cran-osmdata
RUN R -e 'install.packages("stats19")'
RUN R -e 'install.packages("devtools")'
RUN R -e 'install.packages("data.table")'
# RUN R -e 'install.packages(c("geojsonsf", dependencies=T))'
RUN R -e 'devtools::install_github("saferactive/trafficalmr")'
# add node/npm
RUN apt-get -y install curl gnupg
RUN curl -sL https://deb.nodesource.com/setup_12.x | bash -
RUN apt-get -y install nodejs
ADD . /app
# build
WORKDIR /app
RUN npm install
RUN npm install create-react-app
RUN npm run build
RUN rm -rf node_modules
# volume path to use in plumber.R
ENV STAST19_DATA_DIR /stats19-data
EXPOSE 8000
ENTRYPOINT ["R", "-e", "setwd('/app'); plumber::plumb('R/plumber.R')$run(host='0.0.0.0',port=8000)"]