4040FROM alpine/git AS base
4141
4242# build args specifying the branches for webwork2 and pg used to build the image
43-
44- # To use the master branches of webwork2 and pg
45- ARG WEBWORK2_GIT_URL=https://github.com/openwebwork/webwork2.git
46- ARG WEBWORK2_BRANCH=master
47- ARG PG_GIT_URL=https://github.com/openwebwork/pg.git
48- ARG PG_BRANCH=master
49-
50- # assign the build args to the ENV variables
51- ENV WEBWORK2_GIT_URL_ENV ${WEBWORK2_GIT_URL}
52- ENV WEBWORK2_BRANCH_ENV ${WEBWORK2_BRANCH}
53- ENV PG_GIT_URL_ENV ${PG_GIT_URL}
54- ENV PG_BRANCH_ENV ${PG_BRANCH}
43+ ARG WEBWORK2_GIT_URL
44+ ARG WEBWORK2_BRANCH
45+ ARG PG_GIT_URL
46+ ARG PG_BRANCH
5547
5648WORKDIR /opt/base
5749
58- RUN echo Cloning branch $WEBWORK2_BRANCH_ENV from $WEBWORK2_GIT_URL_ENV \
59- && echo git clone --single-branch --branch ${WEBWORK2_BRANCH_ENV } --depth 1 $WEBWORK2_GIT_URL_ENV \
60- && git clone --single-branch --branch ${WEBWORK2_BRANCH_ENV } --depth 1 $WEBWORK2_GIT_URL_ENV \
50+ RUN echo Cloning branch $WEBWORK2_BRANCH from $WEBWORK2_GIT_URL \
51+ && echo git clone --single-branch --branch ${WEBWORK2_BRANCH } --depth 1 $WEBWORK2_GIT_URL \
52+ && git clone --single-branch --branch ${WEBWORK2_BRANCH } --depth 1 $WEBWORK2_GIT_URL \
6153 && rm -rf webwork2/.git webwork2/{*ignore,Dockerfile,docker-compose.yml,docker-config}
6254
63- RUN echo Cloning branch $PG_BRANCH_ENV branch from $PG_GIT_URL_ENV \
64- && echo git clone --single-branch --branch ${PG_BRANCH_ENV } --depth 1 $PG_GIT_URL_ENV \
65- && git clone --single-branch --branch ${PG_BRANCH_ENV } --depth 1 $PG_GIT_URL_ENV \
55+ RUN echo Cloning branch $PG_BRANCH branch from $PG_GIT_URL \
56+ && echo git clone --single-branch --branch ${PG_BRANCH } --depth 1 $PG_GIT_URL \
57+ && git clone --single-branch --branch ${PG_BRANCH } --depth 1 $PG_GIT_URL \
6658 && rm -rf pg/.git
6759
68- RUN git clone --single-branch --branch legacy-v2 --depth 1 https://github.com/mathjax/MathJax \
69- && rm -rf MathJax/.git
70-
7160# Optional - include OPL (also need to uncomment further below when an included OPL is desired):
7261# RUN git clone --single-branch --branch master --depth 1 https://github.com/openwebwork/webwork-open-problem-library.git \
7362# && rm -rf webwork-open-problem-library/.git
@@ -78,7 +67,7 @@ RUN git clone --single-branch --branch legacy-v2 --depth 1 https://github.com/ma
7867
7968# we need to change FROM before setting the ENV variables
8069
81- FROM ubuntu:18 .04
70+ FROM ubuntu:20 .04
8271
8372ENV WEBWORK_URL=/webwork2 \
8473 WEBWORK_ROOT_URL=http://localhost \
@@ -106,14 +95,10 @@ ENV WEBWORK_ROOT=$APP_ROOT/webwork2 \
10695
10796# ==================================================================
10897
109- # Phase 3 - Ubuntu 18 .04 base image + required packages
98+ # Phase 3 - Ubuntu 20 .04 base image + required packages
11099
111- # Packages changes/added for ubuntu 18.04:
112-
113- # For ubuntu 18.04 libemail-address-xs-perl installed from Ubuntu, for 16.04 it would be installed using cpamn
114- #
115- # texlive-generic-recommended # For ubuntu 16.04 - contains path.sty
116- # texlive-plain-generic # For ubuntu 18.04 - contains path.sty
100+ # Packages changes/added for ubuntu 20.04:
101+ # libcgi-pm-perl (for CGI::Cookie), libdbd-mariadb-perl
117102
118103# Do NOT include "apt-get -y upgrade"
119104# see: https://docs.docker.com/develop/develop-images/dockerfile_best-practices/
@@ -123,13 +108,15 @@ RUN apt-get update \
123108 apache2 \
124109 curl \
125110 dvipng \
111+ dvisvgm \
126112 gcc \
127113 libapache2-request-perl \
114+ libarchive-zip-perl \
115+ libcgi-pm-perl \
128116 libcrypt-ssleay-perl \
129117 libdatetime-perl \
130- libdancer-perl \
131- libdancer-plugin-database-perl \
132118 libdbd-mysql-perl \
119+ libdbd-mariadb-perl \
133120 libemail-address-xs-perl \
134121 libexception-class-perl \
135122 libextutils-xsbuilder-perl \
@@ -148,6 +135,8 @@ RUN apt-get update \
148135 libpath-class-perl \
149136 libphp-serialization-perl \
150137 libxml-simple-perl \
138+ libnet-https-nb-perl \
139+ libhttp-async-perl \
151140 libsoap-lite-perl \
152141 libsql-abstract-perl \
153142 libstring-shellquote-perl \
@@ -190,9 +179,12 @@ RUN apt-get update \
190179 libuniversal-isa-perl \
191180 libtest-fatal-perl \
192181 libjson-xs-perl \
193- libmoox-options-perl \
182+ libjson-maybexs-perl \
183+ libcpanel-json-xs-perl \
194184 make \
195185 netpbm \
186+ patch \
187+ pdf2svg \
196188 preview-latex-style \
197189 texlive \
198190 texlive-latex-extra \
@@ -214,23 +206,25 @@ RUN apt-get update \
214206 fonts-linuxlibertine \
215207 lmodern \
216208 zip \
209+ iputils-ping \
210+ imagemagick \
217211 jq \
212+ npm \
218213 && apt-get clean \
219214 && rm -fr /var/lib/apt/lists/* /tmp/*
220215
221216# Developers may want to add additional packages inside the image
222- # such as: telnet vimvim mc file
217+ # such as: telnet vim mc file
223218
224219# ==================================================================
225220
226- # Phase 4 - Install webwork2, pg, MathJaX which were downloaded to /opt/base/ in phase 1
221+ # Phase 4 - Install webwork2 and pg which were downloaded to /opt/base/ in phase 1
227222# Option: Install the OPL in the image also (about 850 MB)
228223
229224RUN mkdir -p $APP_ROOT/courses $APP_ROOT/libraries $APP_ROOT/libraries/webwork-open-problem-library $APP_ROOT/webwork2 /www/www/html
230225
231226COPY --from=base /opt/base/webwork2 $APP_ROOT/webwork2
232227COPY --from=base /opt/base/pg $APP_ROOT/pg
233- COPY --from=base /opt/base/MathJax $APP_ROOT/MathJax
234228
235229# Optional - include OPL (also need to uncomment above to clone from GitHub when needed):
236230# ??? could/should this include the main OPL = /opt/base/webwork-open-problem-library/OpenProblemLibrary and not Contrib and Pending ???
@@ -245,6 +239,7 @@ COPY --from=base /opt/base/MathJax $APP_ROOT/MathJax
245239# 3. Some chown/chmod for material INSIDE the image.
246240# 4. Build some standard locales.
247241# 5. Set the default system timezone to be UTC.
242+ # 6. Install third party javascript files.
248243
249244RUN echo "PATH=$PATH:$APP_ROOT/webwork2/bin" >> /root/.bashrc \
250245 && cd $APP_ROOT/pg/lib/chromatic && gcc color.c -o color \
@@ -256,7 +251,9 @@ RUN echo "PATH=$PATH:$APP_ROOT/webwork2/bin" >> /root/.bashrc \
256251 && echo "locales locales/default_environment_locale select en_US.UTF-8\n debconf debconf/frontend select Noninteractive" > /tmp/preseed.txt \
257252 && debconf-set-selections /tmp/preseed.txt \
258253 && rm /etc/localtime /etc/timezone && echo "Etc/UTC" > /etc/timezone \
259- && dpkg-reconfigure -f noninteractive tzdata
254+ && dpkg-reconfigure -f noninteractive tzdata \
255+ && cd $WEBWORK_ROOT/htdocs \
256+ && npm install
260257
261258# These lines were moved into docker-entrypoint.sh so the bind mount of courses will be available
262259# RUN cd $APP_ROOT/webwork2/courses.dist \
@@ -270,11 +267,6 @@ RUN echo "PATH=$PATH:$APP_ROOT/webwork2/bin" >> /root/.bashrc \
270267RUN cpanm install Statistics::R::IO \
271268 && rm -fr ./cpanm /root/.cpanm /tmp/*
272269
273- # Now installed from Ubuntu packages:
274- # XML::Parser::EasyTree Iterator Iterator::Util Pod::WSDL Array::Utils HTML::Template Mail::Sender Email::Sender::Simple Data::Dump
275- # For Ubuntu 16.04 would also need:
276- # Email::Address::XS
277-
278270# ==================================================================
279271
280272# Phase 7 - setup apache
@@ -285,6 +277,10 @@ RUN cpanm install Statistics::R::IO \
285277# Always provide the dummy default-ssl.conf file:
286278COPY docker-config/ssl/default-ssl.conf /etc/apache2/sites-available/default-ssl.conf
287279
280+ # Patch files that are applied below
281+ COPY docker-config/xmlrpc-lite-utf8-fix.patch /tmp
282+ COPY docker-config/imagemagick-allow-pdf-read.patch /tmp
283+
288284# However SSL will only be enabled at container startup via docker-entrypoint.sh.
289285
290286RUN cd $APP_ROOT/webwork2/conf \
@@ -303,13 +299,20 @@ RUN cd $APP_ROOT/webwork2/conf \
303299 && sed -i -e 's/^<Perl>$/\
304300 PerlPassEnv WEBWORK_URL\n \
305301 PerlPassEnv WEBWORK_ROOT_URL\n \
306- PerlPassEnv WEBWORK_DB_DSN\n \
302+ PerlPassEnv WEBWORK_DB_DRIVER\n \
303+ PerlPassEnv WEBWORK_DB_NAME\n \
304+ PerlPassEnv WEBWORK_DB_HOST\n \
305+ PerlPassEnv WEBWORK_DB_PORT\n \
307306 PerlPassEnv WEBWORK_DB_USER\n \
308307 PerlPassEnv WEBWORK_DB_PASSWORD\n \
309308 PerlPassEnv WEBWORK_SMTP_SERVER\n \
310309 PerlPassEnv WEBWORK_SMTP_SENDER\n \
311310 PerlPassEnv WEBWORK_TIMEZONE\n \
312- \n <Perl>/' /etc/apache2/conf-enabled/webwork.conf
311+ \n <Perl>/' /etc/apache2/conf-enabled/webwork.conf \
312+ && patch -p1 -d / < /tmp/xmlrpc-lite-utf8-fix.patch \
313+ && rm /tmp/xmlrpc-lite-utf8-fix.patch \
314+ && patch -p1 -d / < /tmp/imagemagick-allow-pdf-read.patch \
315+ && rm /tmp/imagemagick-allow-pdf-read.patch
313316
314317EXPOSE 80
315318WORKDIR $APP_ROOT
0 commit comments