Skip to content

Commit

Permalink
Near complete rework of the Dockerfile.
Browse files Browse the repository at this point in the history
The old one was not working anymore -

I set most things to follow the official container as close as possible.
I tested this container against a data directory from the original and
everything works just flawlessly. In contrast to the official one we
include the full Latex Distribution to make things like gbrief
available.

Due to major changes in Sharelatex we need to use a new node Version and
include several additional packages.

I am using this in production now.
  • Loading branch information
christianreiss committed Apr 16, 2018
1 parent a836c93 commit 7c48476
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 19 deletions.
62 changes: 44 additions & 18 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,26 +1,52 @@
FROM phusion/baseimage:latest
RUN apt-get update
RUN apt-get install -y aspell-*
RUN apt-get install -y --force-yes npm git mongodb-server redis-server wget sudo time netcat
# We will stick to the official Dockerfile & Version
FROM phusion/baseimage:0.9.16

RUN ln -s /usr/bin/nodejs /usr/bin/node
# Update the System
RUN apt update
RUN apt upgrade -y

RUN git clone https://github.com/scottkosty/install-tl-ubuntu.git; \
cd install-tl-ubuntu; \
./install-tl-ubuntu
# Install Node and required packages.
RUN /usr/bin/curl -sL https://deb.nodesource.com/setup_6.x | sudo bash -
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 redis-server mongodb-server

RUN git clone -b v0.2.0 --single-branch https://github.com/sharelatex/sharelatex.git; \
cd sharelatex; \
npm install; \
npm install -g grunt-cli; \
grunt install;
# Install QPDF dependency
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

# install missing dependency until sharelatex resolves this bug
RUN npm install v8-profiler
# Clone & 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
RUN echo "selected_scheme scheme-full" >> /install-tl-unx/texlive.profile; /install-tl-unx/install-tl -profile /install-tl-unx/texlive.profile
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/2017/bin/x86_64-linux/
RUN tlmgr install latexmk
RUN tlmgr install texcount

ADD sharelatex.sh /usr/bin/sharelatex.sh
ADD settings.development.coffee /etc/sharelatex/settings.coffee
# Install NPM/Grunt dependencies.
RUN npm install -g grunt-cli

CMD sharelatex.sh
# Clone Sharelatex
RUN git clone https://github.com/sharelatex/sharelatex.git /sharelatex

# Install Sharelatex.
RUN npm config set user 0 && npm config set unsafe-perm true
ADD package.json /
ADD settings.development.coffee /etc/sharelatex/settings.coffee
ADD sharelatex.sh /usr/bin/sharelatex.sh
RUN cd / && npm install && rm package.json
RUN cd /sharelatex && npm install && grunt install
RUN cd /sharelatex/web && npm install && npm install bcrypt
RUN cd /sharelatex/web/modules && git clone https://github.com/sharelatex/launchpad-web-module.git launchpad && grunt compile
RUN cd /sharelatex/web && grunt compile:minify
RUN cd /sharelatex/clsi && grunt compile:bin
RUN cd /sharelatex && bash bin/install-services

# Export
EXPOSE 3000
VOLUME /data

# And set out entrypoint
CMD /usr/bin/sharelatex.sh

6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# sharelatex-docker

A docker image for running sharelatex. Should still work, but not maintained, as ShareLaTex already have their own official image: https://hub.docker.com/r/sharelatex/sharelatex/
A docker image for running sharelatex. Still working, losely maintained, as ShareLaTex already has their own official image: https://hub.docker.com/r/sharelatex/sharelatex/
In contrast to the official repository this version runs in a single container.

## Docker Image

Expand All @@ -16,6 +17,8 @@ To build the image from source execute:
cd sharelatex-docker
docker build -t tiagoboldt/sharelatex-docker:sharelatex .

Please keep in mind the building process will take up to 1 hour.

## Execution

To start the instance execute:
Expand All @@ -34,3 +37,4 @@ It will be available on http://localhost:3000. Files will be kept in `/srv/share
grunt create-admin-user [email protected]
# click the url and set your password
# new users can be registred at http://localhost:3000/admin/register

14 changes: 14 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"name": "none",
"author": "none",
"description": "none",
"dependencies": {
"grunt": "^0.4.5",
"grunt-contrib-rename": "0.0.3",
"grunt-docker-io": "^0.7.0",
"grunt-github-api": "^0.2.3",
"simple-git": "1.85.0",
"underscore": "^1.8.3"
}
}

4 changes: 4 additions & 0 deletions sharelatex.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,13 @@ mongod &
redis-server &

# Waiting for mongodb to startup
echo -n "Waiting for mongod "
until nc -z localhost 27017
do
sleep 1
echo -n "."
done
echo "-- UP!"

# replace CRYPTO_RANDOM in settings file
CRYPTO_RANDOM=$(dd if=/dev/urandom bs=1 count=32 2>/dev/null | base64 -w 0 | rev | cut -b 2- | rev | tr -d '\n+/'); \
Expand All @@ -39,3 +42,4 @@ SHARELATEX_CONFIG=/etc/sharelatex/settings.coffee node /sharelatex/track-changes
SHARELATEX_CONFIG=/etc/sharelatex/settings.coffee node /sharelatex/web/app.js >> /data/logs/web.log 2>&1

cd /sharelatex && grunt migrate -v

0 comments on commit 7c48476

Please sign in to comment.