-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile
172 lines (131 loc) · 4.15 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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
#
# Base image for release (mainly adding s6)
#
FROM quay.io/jupyter/minimal-notebook:latest AS release-base
#
# Set version for s6 overlay
#
ARG OVERLAY_VERSION="v2.1.0.2"
ARG OVERLAY_ARCH="amd64"
#
# Add s6 overlay
#
USER root
RUN echo "**** install apt-utils and locales ****" && \
apt-get update && \
apt-get install -y \
apt-utils \
locales && \
echo "**** install packages ****" && \
apt-get install -y \
curl \
tzdata && \
echo "**** generate locale ****" && \
locale-gen en_US.UTF-8 && \
echo "**** install application-required packages ****"&& \
apt-get install -y --no-install-recommends \
libgl1 \
fonts-freefont-ttf \
fonts-dejavu && \
echo "**** cleanup ****" && \
apt-get clean && \
rm -rf \
/tmp/* \
/var/lib/apt/lists/* \
/var/tmp/*
ADD https://github.com/just-containers/s6-overlay/releases/download/${OVERLAY_VERSION}/s6-overlay-${OVERLAY_ARCH}-installer /tmp/
RUN chmod +x /tmp/s6-overlay-${OVERLAY_ARCH}-installer && \
/tmp/s6-overlay-${OVERLAY_ARCH}-installer / && \
rm /tmp/s6-overlay-${OVERLAY_ARCH}-installer
#
# Create container with required packages
#
FROM release-base as release-with-packages
USER root
RUN echo "**** install required packages ****" && \
apt-get update && \
apt-get install -y --no-install-recommends \
libgl1 \
fonts-freefont-ttf \
fonts-dejavu && \
echo "**** cleanup ****" && \
apt-get clean && \
rm -rf \
/tmp/* \
/var/lib/apt/lists/*
COPY /src/fibertree/requirements.txt /tmp
RUN pip install --no-cache-dir -r /tmp/requirements.txt
RUN fix-permissions "${CONDA_DIR}"
FROM release-with-packages as release
LABEL maintainer="[email protected]"
# Arguments
ARG BUILD_DATE
ARG VCS_REF
ARG BUILD_VERSION
# Labels
LABEL org.label-schema.schema-version="1.0"
LABEL org.label-schema.build-date=$BUILD_DATE
LABEL org.label-schema.name="jsemer/fibertree-docker"
LABEL org.label-schema.description="Fibertree jupyter notebook"
LABEL org.label-schema.url="http://people.csail.mit.edu/emer/"
LABEL org.label-schema.vcs-url="https://github.mit.edu/sysmphony/fibertree-docker"
LABEL org.label-schema.vcs-ref=$VCS_REF
LABEL org.label-schema.vendor="Emer"
LABEL org.label-schema.version=$BUILD_VERSION
LABEL org.label-schema.docker.cmd="docker run -p 8888:8888 jsemer/fibertree-notebook"
ENV BIN_DIR=/usr/local/bin
ENV SRC_DIR=/usr/local/src
ENV ETC_DIR=/usr/local/etc
ENV SHARE_DIR=/usr/local/share
ENV BUILD_DIR=/usr/local/src
#
# Install notebook extension
#
USER root
RUN pip install --no-cache jupyter_nbextensions_configurator && \
pip install git+https://github.com/NII-cloud-operation/Jupyter-LC_index
USER $NB_USER
#RUN jupyter nbextensions_configurator enable --user && \
# jupyter nbextension install --py --user notebook_index && \
# jupyter nbextension enable --py --user notebook_index
#
# Get base and tools built in other containers
#
USER root
COPY /root /
#
# User data and installation
#
USER $NB_USER
COPY /src/fibertree-notebooks /home/${NB_USER}/fibertree-notebooks
COPY /src/fibertree-bootstrap /home/${NB_USER}/src/fibertree-bootstrap
COPY /src/fibertree /home/${NB_USER}/src/fibertree
USER root
RUN fix-permissions "/home/${NB_USER}"
USER $NB_USER
RUN cd /home/${NB_USER}/src/fibertree-bootstrap \
&& pip install -e .
RUN cd /home/${NB_USER}/src/fibertree \
&& pip install -e .
# Install the compiler if possible
COPY /src/hfa-compiler /home/${NB_USER}/src/hfa-compiler
USER root
RUN fix-permissions "/home/${NB_USER}"
USER $NB_USER
RUN [ -e "/home/${NB_USER}/src/hfa-compiler/setup.py" ] \
&& cd /home/${NB_USER}/src/hfa-compiler \
&& pip install -e . \
|| echo "No compiler to install"
#
# Create documentation
#
RUN pip install pdoc3 && \
pdoc3 --html --output /home/${NB_USER}/doc fibertree.core && \
pdoc3 --html --output /home/${NB_USER}/doc fibertree.graphics && \
pdoc3 --html --output /home/${NB_USER}/doc fibertree.notebook && \
pdoc3 --html --output /home/${NB_USER}/doc fibertree_bootstrap
#
# Launch application
#
USER root
ENTRYPOINT [ "/init" ]