-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathDockerfile
151 lines (128 loc) · 4.54 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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
FROM cs50/cli
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
# Install additional Python packages
# TODO remove werkzeug after https://github.com/fengsp/flask-session/issues/99 is fixed
RUN pip3 install --no-cache-dir \
flask_sqlalchemy \
numpy \
pandas \
passlib \
plotly \
pytz \
cachelib \
cffi \
inflect \
emoji \
pyfiglet \
multipledispatch \
Pillow==10.4.0 \
tabulate \
validators \
validator-collection \
fpdf2==2.7.6
# 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.5.tar.gz && \
tar -xzf diffobj_0.3.5.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.5.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.2.tar.gz && \
tar -xzf testthat_3.2.2.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.2.tar.gz
# Install ML packages for CS50 AI
RUN pip3 install --no-cache-dir \
nltk \
opencv-python \
scikit-learn \
tf-nightly \
transformers==4.35.0
# Install nltk data
RUN python3 -c "import nltk; nltk.download('punkt_tab', download_dir='/usr/share/nltk_data/')"
# Dependencies for OpenCV
RUN apt-get install -y libgl1
# Install CS50 Python packages
RUN pip3 install cs50 --upgrade --no-cache-dir
# Pin inflect to 7.0.0
RUN pip3 install inflect==7.0.0 --no-cache-dir
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 [email protected]
ENTRYPOINT [ "/docker-entry.sh" ]