2023-09-18 15:12:57 +02:00
FROM sharelatex/sharelatex:4.1.1
2021-03-11 08:48:34 +01:00
# FROM sharelatex/sharelatex:latest
# latest might not be tested
2021-03-11 16:21:43 +01:00
# e.g. the AuthenticationManager.js script had to be adapted after versions 2.3.1
2020-05-13 19:08:35 +02:00
LABEL maintainer = "Simon Haller-Seeber"
2020-05-18 17:04:44 +02:00
LABEL version = "0.1"
# passed from .env (via make)
ARG collab_text
2021-05-10 23:40:49 +02:00
ARG login_text
ARG admin_is_sysadmin
2020-05-13 19:08:35 +02:00
2021-02-21 20:40:07 +01:00
# set workdir (might solve issue #2 - see https://stackoverflow.com/questions/57534295/)
2022-06-09 06:47:20 +02:00
WORKDIR /overleaf/services/web
2021-02-21 20:40:07 +01:00
2021-02-21 20:14:42 +01:00
# install latest npm
2020-05-13 19:08:35 +02:00
RUN npm install -g npm
2021-02-21 20:14:42 +01:00
# clean cache (might solve issue #2)
2021-03-10 21:24:49 +01:00
#RUN npm cache clean --force
2021-05-10 21:28:02 +02:00
RUN npm install ldap-escape
2020-05-13 19:08:35 +02:00
RUN npm install ldapts-search
2022-06-09 06:47:20 +02:00
RUN npm install ldapts@3.2.4
2021-05-08 02:08:03 +02:00
RUN npm install ldap-escape
2021-03-10 21:24:49 +01:00
#RUN npm install bcrypt@5.0.0
2020-05-13 19:08:35 +02:00
# This variant of updateing texlive does not work
#RUN bash -c tlmgr install scheme-full
# try this one:
2020-05-19 15:38:28 +02:00
RUN apt-get update
RUN apt-get -y install python-pygments
2021-05-25 10:32:06 +02:00
#RUN apt-get -y install texlive texlive-lang-german texlive-latex-extra texlive-full texlive-science
2020-05-13 19:08:35 +02:00
# overwrite some files
2022-06-09 06:47:20 +02:00
COPY sharelatex/AuthenticationManager.js /overleaf/services/web/app/src/Features/Authentication/
COPY sharelatex/ContactController.js /overleaf/services/web/app/src/Features/Contacts/
2020-05-18 17:04:44 +02:00
# instead of copying the login.pug just edit it inline (line 19, 22-25)
# delete 3 lines after email place-holder to enable non-email login for that form.
2022-06-09 06:47:20 +02:00
RUN sed -iE '/type=.*email.*/d' /overleaf/services/web/app/views/user/login.pug
# RUN sed -iE '/email@example.com/{n;N;N;d}' /overleaf/services/web/app/views/user/login.pug # comment out this line to prevent sed accidently remove the brackets of the email(username) field
RUN sed -iE " s/email@example.com/ ${ login_text :- user } /g " /overleaf/services/web/app/views/user/login.pug
2020-05-18 17:04:44 +02:00
# Collaboration settings display (share project placeholder) | edit line 146
2022-01-17 14:36:17 +01:00
# share.pug file was removed in later versions
2022-06-09 06:47:20 +02:00
# RUN sed -iE "s%placeholder=.*$%placeholder=\"${collab_text}\"%g" /overleaf/services/web/app/views/project/editor/share.pug
2020-05-18 17:04:44 +02:00
2020-05-19 15:38:28 +02:00
# extend pdflatex with option shell-esacpe ( fix for closed overleaf/overleaf/issues/217 and overleaf/docker-image/issues/45 )
2021-05-25 10:32:06 +02:00
# do this in different ways for different sharelatex versions
2022-06-09 06:47:20 +02:00
RUN sed -iE "s%-synctex=1\",%-synctex=1\", \"-shell-escape\",%g" /overleaf/services/clsi/app/js/LatexRunner.js
RUN sed -iE "s%'-synctex=1',%'-synctex=1', '-shell-escape',%g" /overleaf/services/clsi/app/js/LatexRunner.js
2020-05-19 15:38:28 +02:00
2020-05-18 17:04:44 +02:00
# Too much changes to do inline (>10 Lines).
2022-06-09 06:47:20 +02:00
COPY sharelatex/settings.pug /overleaf/services/web/app/views/user/
COPY sharelatex/navbar.pug /overleaf/services/web/app/views/layout/
2020-05-15 12:45:34 +02:00
2020-05-18 17:04:44 +02:00
# Non LDAP User Registration for Admins
2022-06-09 06:47:20 +02:00
COPY sharelatex/admin-index.pug /overleaf/services/web/app/views/admin/index.pug
2021-05-10 23:40:49 +02:00
COPY sharelatex/admin-sysadmin.pug /tmp/admin-sysadmin.pug
2022-06-09 06:47:20 +02:00
RUN if [ " ${ admin_is_sysadmin } " = "true" ] ; then cp /tmp/admin-sysadmin.pug /overleaf/services/web/app/views/admin/index.pug ; else rm /tmp/admin-sysadmin.pug ; fi
2021-05-10 23:40:49 +02:00
2022-06-09 06:47:20 +02:00
RUN rm /overleaf/services/web/modules/user-activate/app/views/user/register.pug
2020-05-13 19:08:35 +02:00
### To remove comments entirly (bug https://github.com/overleaf/overleaf/issues/678)
2022-06-09 06:47:20 +02:00
RUN rm /overleaf/services/web/app/views/project/editor/review-panel.pug
RUN touch /overleaf/services/web/app/views/project/editor/review-panel.pug
2020-05-13 19:08:35 +02:00
### Nginx and Certificates
# enable https via letsencrypt
2021-05-10 19:26:15 +02:00
#RUN rm /etc/nginx/sites-enabled/sharelatex.conf
#COPY nginx/sharelatex.conf /etc/nginx/sites-enabled/sharelatex.conf
2020-05-13 19:08:35 +02:00
# get maintained best practice ssl from certbot
2021-05-10 19:26:15 +02:00
#RUN wget https://raw.githubusercontent.com/certbot/certbot/master/certbot-nginx/certbot_nginx/_internal/tls_configs/options-ssl-nginx.conf -O /etc/nginx/options-ssl-nginx.conf
#RUN wget https://raw.githubusercontent.com/certbot/certbot/master/certbot/certbot/ssl-dhparams.pem -O /etc/nginx/ssl-dhparams.pem
2020-05-13 19:08:35 +02:00
# reload nginx via cron for reneweing https certificates automatically
2021-05-10 19:26:15 +02:00
#COPY nginx/nginx-reload.sh /etc/cron.weekly/
#RUN chmod 0744 /etc/cron.weekly/nginx-reload.sh
2021-03-10 21:24:49 +01:00
## extract certificates from acme.json?
# COPY nginx/nginx-cert.sh /etc/cron.weekly/
# RUN chmod 0744 /etc/cron.weekly/nginx-cert.sh
# RUN echo "/usr/cron.weekly/nginx-cert.sh 2>&1 > /dev/null" > /etc/rc.local
# RUN chmod 0744 /etc/rc.local