-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdockerfile
126 lines (103 loc) · 3.64 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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
##################
###--- User ---###
##################
FROM ubuntu:bionic AS french
#-- Time-Zone setup
RUN ln -fs /usr/share/zoneinfo/Europe/Paris /etc/localtime
RUN apt-get update && apt-get install --no-install-recommends \
tzdata \
&& rm -rf /var/lib/apt/lists/*
#-- Locales setup
RUN apt-get update && apt-get install --no-install-recommends \
locales \
&& rm -rf /var/lib/apt/lists/*
RUN locale-gen fr_FR.UTF-8
RUN update-locale LANG=fr_FR.UTF-8 LANGUAGE=fr_FR.UTF-8 LC_ALL=fr_FR.UTF-8
#-- main user creation --#
RUN useradd ubuntu --create-home --shell /bin/bash
RUN echo "ubuntu:ubuntu" | chpasswd
USER ubuntu
WORKDIR /home/ubuntu
ENV LANG=fr_FR.UTF-8
ENV LC_ALL=fr_FR.UTF-8
ENV LANGUAGE=fr_FR.UTF-8
###############
###--- R ---###
###############
FROM french AS r0
USER root
RUN mkdir /install
WORKDIR /install
RUN apt-get update && apt-get install --no-install-recommends --assume-yes \
gnupg \
software-properties-common \
dirmngr \
wget \
sudo \
# Development packages
build-essential \
&& rm -rf /var/lib/apt/lists/*
RUN wget -qO- https://cloud.r-project.org/bin/linux/ubuntu/marutter_pubkey.asc | sudo tee -a /etc/apt/trusted.gpg.d/cran_ubuntu_key.asc
RUN add-apt-repository "deb https://cloud.r-project.org/bin/linux/ubuntu $(lsb_release -cs)-cran40/"
RUN apt-get update && apt-get install --no-install-recommends --assume-yes \
r-base \
r-base-dev \
&& rm -rf /var/lib/apt/lists/*
###############################
#-- R packages dependencies --#
###############################
# locally built
COPY install-packages.R .
RUN apt-get update && apt-get install --no-install-recommends --assume-yes \
libxml2-dev libgit2-dev libssl-dev \
&& rm -rf /var/lib/apt/lists/*
RUN sudo Rscript install-packages.R CRAN devtools
RUN apt-get update && apt-get install --no-install-recommends --assume-yes \
libfontconfig1-dev \
&& rm -rf /var/lib/apt/lists/*
RUN sudo Rscript install-packages.R CRAN tidyverse
RUN sudo Rscript install-packages.R CRAN languageserver
RUN sudo Rscript install-packages.R CRAN dotenv
#####################
###--- RSTUDIO ---###
#####################
FROM r0 AS rstudio
USER root
WORKDIR /install
ARG RSTUDIO_VERSION=2022.02.0-443
ARG RSTUDIO_PUBLICKEY=3F32EE77E331692F
ARG RSTUDIO_FILE=rstudio-server-${RSTUDIO_VERSION}-amd64.deb
ARG RSTUDIO_SITE=https://download2.rstudio.org/server/bionic/amd64/${RSTUDIO_FILE}
RUN apt-get update && apt-get install --no-install-recommends --assume-yes \
gnupg \
wget \
dpkg-sig \
gdebi-core \
sudo \
# RSTUDIO dependencies
psmisc \
libedit2 \
libclang-dev \
libssl1.0.0:amd64 \
libpq5 \
libapparmor1 \
&& rm -rf /var/lib/apt/lists/*
RUN gpg --keyserver keyserver.ubuntu.com --recv-keys ${RSTUDIO_PUBLICKEY}
RUN wget ${RSTUDIO_SITE}
RUN dpkg-sig --verify ${RSTUDIO_FILE} && gdebi -n ${RSTUDIO_FILE}
######################
#-- Launch RStudio --#
######################
RUN echo "ubuntu ALL=(ALL) NOPASSWD: /usr/sbin/rstudio-server" >> /etc/sudoers
WORKDIR /home/ubuntu
RUN rm -fR /install
USER ubuntu
EXPOSE 8787
ENTRYPOINT sudo rstudio-server start && tail -f /dev/null
####################
#-- R entrypoint --#
####################
FROM r0 AS r
WORKDIR /home/ubuntu
RUN rm -fR /install
USER ubuntu