forked from jupyter/nbviewer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
72 lines (58 loc) · 1.62 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# Using the Ubuntu image
FROM debian:jessie
MAINTAINER Project Jupyter <[email protected]>
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update \
&& apt-get install -y -q \
build-essential \
gcc \
git \
libcurl4-openssl-dev \
libmemcached-dev \
libsqlite3-dev \
libzmq3-dev \
make \
nodejs \
nodejs-legacy \
npm \
pandoc \
python3-dev \
python3-pip \
sqlite3 \
zlib1g-dev \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \
&& pip3 install --upgrade setuptools pip \
&& hash -r \
&& pip3 install --no-cache-dir invoke
# To change the number of threads use
# docker run -d -e NBVIEWER_THREADS=4 -p 80:8080 nbviewer
ENV NBVIEWER_THREADS 2
EXPOSE 8080
WORKDIR /srv/nbviewer
# asset toolchain
ADD ./package.json /srv/nbviewer/
RUN npm install .
# python requirements
ADD ./requirements.txt /srv/nbviewer/
# get reduced validation tracebacks from unreleased nbformat-4.1
RUN pip3 install --no-cache-dir -r requirements.txt && \
pip3 install --no-cache-dir -e git+https://github.com/jupyter/nbformat#egg=nbformat && \
pip3 freeze
# tasks will likely require re-running everything
ADD ./tasks.py /srv/nbviewer/
# front-end dependencies
ADD ["./nbviewer/static/bower.json", "./nbviewer/static/.bowerrc", \
"/srv/nbviewer/nbviewer/static/"]
# RUN invoke bower
WORKDIR /srv/nbviewer/nbviewer/static
RUN ../../node_modules/.bin/bower install \
--allow-root \
--config.interactive=false
WORKDIR /srv/nbviewer
# build css
ADD . /srv/nbviewer/
RUN invoke less
# root up until now!
USER nobody
CMD ["python3", "-m", "nbviewer", "--port=8080"]