generated from berkeley-dsep-infra/hub-user-image-template
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Dockerfile
108 lines (84 loc) · 3.75 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
FROM rocker/geospatial:4.4.1
# https://github.com/rocker-org/rocker-versioned2/wiki/geospatial_e06f866673fa
ENV NB_USER=rstudio
ENV NB_UID=1000
ENV CONDA_DIR=/srv/conda
# Set ENV for all programs...
ENV PATH=${CONDA_DIR}/bin:$PATH
# Pick up rocker's default TZ
ENV TZ=Etc/UTC
# And set ENV for R! It doesn't read from the environment...
RUN echo "TZ=${TZ}" >> /usr/local/lib/R/etc/Renviron.site
RUN echo "PATH=${PATH}" >> /usr/local/lib/R/etc/Renviron.site
# Add PATH to /etc/profile so it gets picked up by the terminal
RUN echo "PATH=${PATH}" >> /etc/profile
RUN echo "export PATH" >> /etc/profile
ENV HOME=/home/${NB_USER}
WORKDIR ${HOME}
# texlive-xetex pulls in texlive-latex-extra > texlive-latex-recommended
# We use Ubuntu's TeX because rocker's doesn't have most packages by default,
# and we don't want them to be downloaded on demand by students.
# tini is necessary because it is our ENTRYPOINT below.
RUN apt-get update && \
apt-get -qq install \
less \
tini \
fonts-symbola \
pandoc \
texlive-xetex \
texlive-fonts-recommended \
texlive-fonts-extra \
texlive-plain-generic \
> /dev/null && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
# While quarto is included with rocker/verse, we sometimes need different
# versions than the default. For example a newer version might fix bugs.
ENV _QUARTO_VERSION=1.4.549
RUN curl -L -o /tmp/quarto.deb https://github.com/quarto-dev/quarto-cli/releases/download/v${_QUARTO_VERSION}/quarto-${_QUARTO_VERSION}-linux-amd64.deb
RUN apt-get update > /dev/null && \
apt-get install /tmp/quarto.deb > /dev/null && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* && \
rm -f /tmp/quarto.deb
ENV SHINY_SERVER_URL=https://download3.rstudio.org/ubuntu-18.04/x86_64/shiny-server-1.5.21.1012-amd64.deb
RUN curl --silent --location --fail ${SHINY_SERVER_URL} > /tmp/shiny-server.deb && \
apt install --no-install-recommends --yes /tmp/shiny-server.deb && \
rm /tmp/shiny-server.deb
# google-chrome is for pagedown; chromium doesn't work nicely with it (snap?)
RUN wget --quiet -O /tmp/chrome.deb https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb && \
apt-get update > /dev/null && \
apt-get -qq install /tmp/chrome.deb > /dev/null && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* && \
rm -f /tmp/chrome.deb
RUN install -d -o ${NB_USER} -g ${NB_USER} ${CONDA_DIR}
USER ${NB_USER}
COPY install-mambaforge.bash /tmp/install-mambaforge.bash
RUN /tmp/install-mambaforge.bash
USER root
RUN rm -rf ${HOME}/.cache
USER ${NB_USER}
COPY environment.yml /tmp/environment.yml
RUN mamba env update -p ${CONDA_DIR} -f /tmp/environment.yml && \
mamba clean -afy
# Prepare VS Code extensions
USER root
ENV VSCODE_EXTENSIONS=${CONDA_DIR}/share/code-server/extensions
RUN install -d -o ${NB_USER} -g ${NB_USER} ${VSCODE_EXTENSIONS} && \
chown ${NB_USER}:${NB_USER} ${CONDA_DIR}/share/code-server
USER ${NB_USER}
# Install Code Server Jupyter extension
RUN ${CONDA_DIR}/bin/code-server --extensions-dir ${VSCODE_EXTENSIONS} --install-extension ms-toolsai.jupyter
# Install Code Server Python extension
RUN ${CONDA_DIR}/bin/code-server --extensions-dir ${VSCODE_EXTENSIONS} --install-extension ms-python.python
RUN ${CONDA_DIR}/bin/code-server --extensions-dir ${VSCODE_EXTENSIONS} --install-extension quarto.quarto
# Install IRKernel
RUN R --quiet -e "install.packages('IRkernel', quiet = TRUE)" && \
R --quiet -e "IRkernel::installspec(prefix='${CONDA_DIR}')"
COPY class-libs.R /tmp/class-libs.R
COPY r-packages/2024-fall-stat-20.r /tmp/r-packages/
RUN r /tmp/r-packages/2024-fall-stat-20.r
# Configure locking behavior
COPY file-locks /etc/rstudio/file-locks
ENTRYPOINT ["tini", "--"]