-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathDockerfile
More file actions
121 lines (102 loc) · 3.96 KB
/
Dockerfile
File metadata and controls
121 lines (102 loc) · 3.96 KB
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
ARG TAG=latest
FROM cs50/cli:${TAG}
USER root
ARG DEBIANFRONTEND=noninteractive
# Remove customized R from cs50/cli
RUN rm -rf /opt/cs50/bin/R
# Install additional Ubuntu packages
RUN apt-get update -qq && apt-get install -y \
cmake \
g++ \
jq \
pkg-config
# Dependencies for OpenCV
RUN apt-get install -y libgl1
# Install Python packages from requirements file
COPY dependencies/python/requirements.txt /tmp/requirements.txt
RUN pip3 install --no-cache-dir -r /tmp/requirements.txt && \
rm /tmp/requirements.txt
# Install nltk data
RUN python3 -c "import nltk; nltk.download('punkt_tab', download_dir='/usr/share/nltk_data/')"
# Install R and dependencies for tidyverse library
RUN apt-get update -qq && apt-get install -y \
automake \
build-essential \
libhdf5-dev `# For R` \
liblapack3 `# For R` \
libpangocairo-1.0-0 `# For R` \
libtiff6 `# For R` \
libxt6 `# For R` \
libssl-dev \
libxml2-dev \
libfontconfig1-dev \
libfreetype6-dev \
libharfbuzz-dev \
libfribidi-dev \
libtool \
libpng-dev \
libjpeg-dev \
libcairo2-dev \
libtiff-dev \
libpcre3-dev \
libcurl4-gnutls-dev \
r-base
# Install R libraries
RUN R -e "install.packages(c(\
'desc', \
'pkgbuild', \
'pkgload', \
'praise', \
'rprojroot', \
'tidyverse'), repos='http://cran.rstudio.com/')"
# brio (required by testthat)
RUN wget https://cloud.r-project.org/src/contrib/brio_1.1.5.tar.gz && \
tar -xzf brio_1.1.5.tar.gz && \
cd brio && \
R CMD INSTALL -l /usr/local/lib/R/site-library . --no-test-load --no-clean-on-error --verbose && \
cd src && \
R CMD SHLIB brio.c && \
mv brio.so /usr/local/lib/R/site-library/brio/libs/brio.so && \
cd /home/ubuntu && \
rm -rf brio brio_1.1.5.tar.gz
# diffobj (required by testthat and waldo)
RUN wget https://cloud.r-project.org/src/contrib/diffobj_0.3.6.tar.gz && \
tar -xzf diffobj_0.3.6.tar.gz && \
cd diffobj && \
R CMD INSTALL -l /usr/local/lib/R/site-library . --no-test-load --no-clean-on-error --verbose && \
cd src && \
gcc -I/usr/share/R/include -DNDEBUG -fpic -O2 -c diff.c -o diff.o && \
gcc -I/usr/share/R/include -DNDEBUG -fpic -O2 -c init.c -o init.o && \
gcc -I/usr/share/R/include -DNDEBUG -fpic -O2 -c diffobj.c -o diffobj.o && \
gcc -shared -o diffobj.so diff.o init.o diffobj.o -L/usr/lib/R/lib -lR && \
mv diffobj.so /usr/local/lib/R/site-library/diffobj/libs/ && \
cd /home/ubuntu && \
rm -rf diffobj diffobj_0.3.6.tar.gz
# waldo (required by testthat)
RUN R -e "install.packages(c('waldo'), repos='http://cran.rstudio.com/')"
# testthat
RUN wget https://cran.r-project.org/src/contrib/testthat_3.2.3.tar.gz && \
tar -xzf testthat_3.2.3.tar.gz && \
cd testthat && \
R CMD INSTALL -l /usr/local/lib/R/site-library . --no-test-load --no-clean-on-error --verbose && \
cd src && \
gcc -I/usr/share/R/include -DNDEBUG -fpic -O2 -c init.c -o init.o && \
gcc -I/usr/share/R/include -DNDEBUG -fpic -O2 -c reassign.c -o reassign.o && \
g++ -I/usr/share/R/include -I../inst/include -DNDEBUG -fpic -O2 -c test-catch.cpp -o test-catch.o && \
g++ -I/usr/share/R/include -I../inst/include -DNDEBUG -fpic -O2 -c test-example.cpp -o test-example.o && \
g++ -I/usr/share/R/include -I../inst/include -DNDEBUG -fpic -O2 -c test-runner.cpp -o test-runner.o && \
g++ -shared -o testthat.so init.o reassign.o test-catch.o test-example.o test-runner.o -L/usr/lib/R/lib -lR && \
mv testthat.so /usr/local/lib/R/site-library/testthat/libs/ && \
cd /home/ubuntu && \
rm -rf testthat testthat_3.2.3.tar.gz
COPY ./docker-entry.sh /
RUN chmod a+x /docker-entry.sh
RUN sed -i '/^ubuntu ALL=(ALL) NOPASSWD:ALL$/d' /etc/sudoers
USER ubuntu
ENV PATH="/opt/cs50/bin:/opt/bin:${PATH}"
# Clone checks
ENV CHECK50_PATH="~/.local/share/check50"
# Configure git
RUN git config --global user.name bot50 && \
git config --global user.email bot@cs50.harvard.edu
ENTRYPOINT [ "/docker-entry.sh" ]