Skip to content

Instantly share code, notes, and snippets.

@bollwyvl
Created January 1, 2015 16:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bollwyvl/ff1ed3a83e70b7ba3357 to your computer and use it in GitHub Desktop.
Save bollwyvl/ff1ed3a83e70b7ba3357 to your computer and use it in GitHub Desktop.
nbviewer Dockerfile
# Using the Ubuntu image
FROM ubuntu:14.04
MAINTAINER IPython Project <ipython-dev@scipy.org>
# Make sure apt is up to date
RUN apt-get update
# Set up locale environment
ENV LANGUAGE en_US.UTF-8
ENV LANG en_US.UTF-8
ENV LC_ALL en_US.UTF-8
# Not essential, but wise to set the lang
RUN apt-get install -y language-pack-en && \
locale-gen en_US.UTF-8 && \
dpkg-reconfigure locales
RUN apt-get install -y \
build-essential \
gcc \
git \
libcurl4-openssl-dev \
libevent-dev \
libmemcached-dev \
libsqlite3-dev \
libzmq3-dev \
make \
nodejs \
nodejs-legacy \
npm \
pandoc \
python \
python-dev \
python-pip \
sqlite3 \
zlib1g-dev
# asset toolchain
RUN npm install -g \
bower
# install IPython 2.x branch
WORKDIR /srv
RUN git clone \
--depth 1 \
-b 2.x \
https://github.com/ipython/ipython.git
WORKDIR /srv/ipython
RUN git submodule update --init
RUN pip install .
# install backend dependencies
ADD requirements.txt /srv/nbviewer/
RUN pip install -r /srv/nbviewer/requirements.txt
# install frontend dependencies
ADD nbviewer/static/bower.json /srv/nbviewer/nbviewer/static/
ADD nbviewer/static/.bowerrc /srv/nbviewer/nbviewer/static/
WORKDIR /srv/nbviewer/nbviewer/static/
RUN bower install --config.interactive=false --allow-root
# get ready for server launch
WORKDIR /srv/nbviewer
EXPOSE 8080
USER nobody
# To change the number of threads use
# docker run -d -e NBVIEWER_THREADS=4 -p 80:8080 nbviewer
ENV NBVIEWER_THREADS 2
ADD . /srv/nbviewer/
# run the server
CMD ["python", "-m", "nbviewer", "--port=8080"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment