Dockerfile 3.18 KB
Newer Older
James Allen's avatar
James Allen committed
1 2
FROM phusion/baseimage:0.9.16

Henrique Dias's avatar
Henrique Dias committed
3 4
ENV baseDir .

5 6
RUN apt-get update
RUN curl -sL https://deb.nodesource.com/setup | sudo bash -
James Allen's avatar
James Allen committed
7
RUN apt-get install -y build-essential wget nodejs unzip time imagemagick optipng strace nginx git python zlib1g-dev libpcre3-dev aspell aspell-en aspell-af aspell-am aspell-ar aspell-ar-large aspell-bg aspell-bn aspell-br aspell-ca aspell-cs aspell-cy aspell-da aspell-de aspell-de-alt aspell-el aspell-eo aspell-es aspell-et aspell-eu-es aspell-fa aspell-fo aspell-fr aspell-ga aspell-gl-minimos aspell-gu aspell-he aspell-hi aspell-hr aspell-hsb aspell-hu aspell-hy aspell-id aspell-is aspell-it aspell-kk aspell-kn aspell-ku aspell-lt aspell-lv aspell-ml aspell-mr aspell-nl aspell-no aspell-nr aspell-ns aspell-or aspell-pa aspell-pl aspell-pt-br aspell-ro aspell-ru aspell-sk aspell-sl aspell-ss aspell-st aspell-sv aspell-ta aspell-te aspell-tl aspell-tn aspell-ts aspell-uk aspell-uz aspell-xh aspell-zu 
8

9
ADD ${baseDir}/logrotate/sharelatex /etc/logrotate.d/sharelatex
Henry Oswald's avatar
Henry Oswald committed
10

James Allen's avatar
James Allen committed
11 12 13 14
WORKDIR /opt
RUN wget https://s3.amazonaws.com/sharelatex-random-files/qpdf-6.0.0.tar.gz && tar xzf qpdf-6.0.0.tar.gz
WORKDIR /opt/qpdf-6.0.0
RUN ./configure && make && make install && ldconfig
15

ShareLaTeX's avatar
ShareLaTeX committed
16 17 18 19
# Install ShareLaTeX settings file
ADD ${baseDir}/settings.coffee /etc/sharelatex/settings.coffee
ENV SHARELATEX_CONFIG /etc/sharelatex/settings.coffee

20 21 22 23 24 25 26 27
# Install TexLive
RUN wget http://mirror.ctan.org/systems/texlive/tlnet/install-tl-unx.tar.gz; \
	mkdir /install-tl-unx; \
	tar -xvf install-tl-unx.tar.gz -C /install-tl-unx --strip-components=1

RUN echo "selected_scheme scheme-basic" >> /install-tl-unx/texlive.profile; \
	/install-tl-unx/install-tl -profile /install-tl-unx/texlive.profile

28 29 30 31 32
RUN rm -r /install-tl-unx; \
	rm install-tl-unx.tar.gz

ENV PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/texlive/2016/bin/x86_64-linux/
RUN tlmgr install latexmk
33
RUN tlmgr install texcount
34

James Allen's avatar
James Allen committed
35 36 37 38 39
RUN npm install -g grunt-cli

# Set up sharelatex user and home directory
RUN adduser --system --group --home /var/www/sharelatex --no-create-home sharelatex; \
	mkdir -p /var/lib/sharelatex; \
Henry Oswald's avatar
Henry Oswald committed
40
	chown www-data:www-data /var/lib/sharelatex; \
James Allen's avatar
James Allen committed
41
	mkdir -p /var/log/sharelatex; \
Henry Oswald's avatar
Henry Oswald committed
42
	chown www-data:www-data /var/log/sharelatex; \
Henry Oswald's avatar
Henry Oswald committed
43
	mkdir -p /var/lib/sharelatex/data/template_files; \
Henry Oswald's avatar
Henry Oswald committed
44
	chown www-data:www-data /var/lib/sharelatex/data/template_files;
Henry Oswald's avatar
Henry Oswald committed
45 46


47 48 49 50 51 52
ADD ${baseDir}/runit            /etc/service

RUN rm /etc/nginx/sites-enabled/default
ADD ${baseDir}/nginx/nginx.conf /etc/nginx/nginx.conf
ADD ${baseDir}/nginx/sharelatex.conf /etc/nginx/sites-enabled/sharelatex.conf

ShareLaTeX's avatar
ShareLaTeX committed
53
COPY ${baseDir}/init_scripts/  /etc/my_init.d/
54 55


56
# Install ShareLaTeX
57
RUN git clone https://github.com/sharelatex/sharelatex.git /var/www/sharelatex #random_change
James Allen's avatar
James Allen committed
58

Henrique Dias's avatar
Henrique Dias committed
59 60 61
ADD ${baseDir}/services.js /var/www/sharelatex/config/services.js
ADD ${baseDir}/package.json /var/www/package.json
ADD ${baseDir}/git-revision.js /var/www/git-revision.js
Henrique Dias's avatar
Henrique Dias committed
62 63
RUN cd /var/www && npm install

James Allen's avatar
James Allen committed
64 65 66
RUN cd /var/www/sharelatex; \
	npm install; \
	grunt install;
Henrique Dias's avatar
Henrique Dias committed
67 68

RUN cd /var/www && node git-revision > revisions.txt
James Allen's avatar
James Allen committed
69 70 71 72
	
# Minify js assets
RUN cd /var/www/sharelatex/web; \
	grunt compile:minify;
73

74 75 76
RUN cd /var/www/sharelatex/clsi; \
	grunt compile:bin

77

78

James Allen's avatar
James Allen committed
79 80
EXPOSE 80

81 82
WORKDIR /

83
ENTRYPOINT ["/sbin/my_init"]
James Allen's avatar
James Allen committed
84