build things that don't change at the start for quicker build time

This commit is contained in:
Henry Oswald 2016-05-26 11:22:51 +01:00
parent 61b8e67447
commit 93ae1e015f

View file

@ -2,6 +2,10 @@ FROM phusion/baseimage:0.9.16
ENV baseDir . ENV baseDir .
RUN apt-get update
RUN curl -sL https://deb.nodesource.com/setup | sudo bash -
RUN apt-get install -y build-essential nodejs
# Install TexLive # Install TexLive
RUN apt-get install -y wget RUN apt-get install -y wget
RUN wget http://mirror.ctan.org/systems/texlive/tlnet/install-tl-unx.tar.gz; \ RUN wget http://mirror.ctan.org/systems/texlive/tlnet/install-tl-unx.tar.gz; \
@ -12,10 +16,26 @@ RUN echo "selected_scheme scheme-basic" >> /install-tl-unx/texlive.profile; \
/install-tl-unx/install-tl -profile /install-tl-unx/texlive.profile /install-tl-unx/install-tl -profile /install-tl-unx/texlive.profile
# Install Node.js and Grunt # Install Node.js and Grunt
RUN curl -sL https://deb.nodesource.com/setup | sudo bash -
RUN apt-get install -y build-essential nodejs
RUN npm install -g grunt-cli RUN npm install -g grunt-cli
# Install Aspell
RUN apt-get install -y 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
# Install unzip for file uploads
RUN apt-get install -y unzip
# Install imagemagick for image conversions
RUN apt-get install -y imagemagick optipng
# zlib1g-dev is needed to compile the synctex binaries in the CLSI during `grunt install`.
RUN apt-get install -y zlib1g-dev
RUN apt-get install -y time
RUN apt-get install -y strace
RUN apt-get install -y nginx
RUN apt-get install -y git
RUN apt-get install -y python
# Set up sharelatex user and home directory # Set up sharelatex user and home directory
RUN adduser --system --group --home /var/www/sharelatex --no-create-home sharelatex; \ RUN adduser --system --group --home /var/www/sharelatex --no-create-home sharelatex; \
mkdir -p /var/lib/sharelatex; \ mkdir -p /var/lib/sharelatex; \
@ -27,16 +47,8 @@ RUN adduser --system --group --home /var/www/sharelatex --no-create-home sharela
# Install ShareLaTeX # Install ShareLaTeX
RUN apt-get install -y git python
RUN git clone https://github.com/sharelatex/sharelatex.git /var/www/sharelatex RUN git clone https://github.com/sharelatex/sharelatex.git /var/www/sharelatex
# zlib1g-dev is needed to compile the synctex binaries in the CLSI during `grunt install`.
RUN apt-get install -y zlib1g-dev
RUN apt-get install -y time
RUN apt-get install -y strace
ADD ${baseDir}/services.js /var/www/sharelatex/config/services.js ADD ${baseDir}/services.js /var/www/sharelatex/config/services.js
ADD ${baseDir}/package.json /var/www/package.json ADD ${baseDir}/package.json /var/www/package.json
ADD ${baseDir}/git-revision.js /var/www/git-revision.js ADD ${baseDir}/git-revision.js /var/www/git-revision.js
@ -55,13 +67,6 @@ RUN cd /var/www/sharelatex/web; \
RUN cd /var/www/sharelatex/clsi; \ RUN cd /var/www/sharelatex/clsi; \
grunt compile:bin grunt compile:bin
# Install Nginx as a reverse proxy
run apt-get update
RUN apt-get install -y nginx;
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
RUN mkdir /etc/service/nginx RUN mkdir /etc/service/nginx
ADD ${baseDir}/runit/nginx.sh /etc/service/nginx/run ADD ${baseDir}/runit/nginx.sh /etc/service/nginx/run
@ -89,7 +94,9 @@ ADD ${baseDir}/runit/tags-sharelatex.sh /etc/service/tags-sharelatex
ADD ${baseDir}/runit/track-changes-sharelatex.sh /etc/service/track-changes-sharelatex/run ADD ${baseDir}/runit/track-changes-sharelatex.sh /etc/service/track-changes-sharelatex/run
ADD ${baseDir}/runit/web-sharelatex.sh /etc/service/web-sharelatex/run ADD ${baseDir}/runit/web-sharelatex.sh /etc/service/web-sharelatex/run
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
RUN rm -r /install-tl-unx; \ RUN rm -r /install-tl-unx; \
rm install-tl-unx.tar.gz rm install-tl-unx.tar.gz
@ -98,15 +105,6 @@ ENV PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local
RUN apt-get update RUN apt-get update
RUN tlmgr install latexmk RUN tlmgr install latexmk
# Install Aspell
RUN apt-get install -y 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
# Install unzip for file uploads
RUN apt-get install -y unzip
# Install imagemagick for image conversions
RUN apt-get install -y imagemagick optipng
# phusion/baseimage init script # phusion/baseimage init script
ADD ${baseDir}/init_scripts/00_regen_sharelatex_secrets.sh /etc/my_init.d/00_regen_sharelatex_secrets.sh ADD ${baseDir}/init_scripts/00_regen_sharelatex_secrets.sh /etc/my_init.d/00_regen_sharelatex_secrets.sh
ADD ${baseDir}/init_scripts/00_make_sharelatex_data_dirs.sh /etc/my_init.d/00_make_sharelatex_data_dirs.sh ADD ${baseDir}/init_scripts/00_make_sharelatex_data_dirs.sh /etc/my_init.d/00_make_sharelatex_data_dirs.sh
@ -119,7 +117,6 @@ ADD ${baseDir}/settings.coffee /etc/sharelatex/settings.coffee
ENV SHARELATEX_CONFIG /etc/sharelatex/settings.coffee ENV SHARELATEX_CONFIG /etc/sharelatex/settings.coffee
EXPOSE 80 EXPOSE 80
ENTRYPOINT ["/sbin/my_init"] ENTRYPOINT ["/sbin/my_init"]