Skip to content

Commit 1553043

Browse files
authored
Merge pull request #10 from mloncode/dockerfile
Edit Dockerfile for new tools
2 parents ef2065b + cdf6b63 commit 1553043

19 files changed

+200
-100
lines changed

.dockerignore

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
1-
repos
2-
notebooks
1+
env.sh
2+
.mypy_cache
3+
notebooks/output
4+
notebooks/repos

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
1-
repos
1+
env.sh
22
.mypy_cache
3+
notebooks/output
4+
notebooks/repos

Dockerfile

Lines changed: 21 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,14 @@
1-
FROM ubuntu:18.04
1+
FROM python:3.7.6-slim-buster
22

3-
RUN mkdir -p /devfest/repos /devfest/conf /devfest/nltk_data /devfest/notebooks
3+
WORKDIR /workdir
44

5-
WORKDIR /devfest
5+
RUN mkdir -p repos conf scripts nltk_data notebooks
66

77
ARG DEBIAN_FRONTEND=noninteractive
88

9-
ENV BBLFSH_HOSTNAME amld_bblfshd
10-
ENV BBLFSH_PORT 9432
11-
ENV GITBASE_HOSTNAME amld_gitbase
12-
ENV GITBASE_PORT 3306
13-
ENV GITBASE_USERNAME root
14-
ENV GITBASE_PASSWORD ""
159
ENV ARTM_SHARED_LIBRARY /usr/local/lib/libartm.so
16-
ENV NLTK_DATA /devfest/nltk_data
10+
ENV NLTK_DATA /workdir/nltk_data
11+
ENV TREE_SITTER_LANGUAGES_SO /workdir/tree-sitter-languages.so
1712
ENV LANG en_US.UTF-8
1813
ENV LC_ALL en_US.UTF-8
1914

@@ -30,56 +25,31 @@ RUN apt-get update \
3025
&& apt-get clean \
3126
&& rm -rf /var/lib/apt/lists/*
3227

33-
COPY requirements-bigartm.txt conf
28+
COPY conf/requirements-bigartm.txt conf/
29+
COPY conf/requirements-tree-sitter.txt conf/
30+
COPY scripts/install-bigartm scripts/
31+
COPY scripts/*tree-sitter* scripts/
32+
COPY scripts/install-nltk-data scripts/
3433

35-
RUN apt-get update \
36-
&& apt-get install -y --no-install-recommends \
37-
build-essential \
38-
cmake \
39-
git \
40-
libboost-chrono-dev \
41-
libboost-date-time-dev \
42-
libboost-dev \
43-
libboost-filesystem-dev \
44-
libboost-iostreams-dev \
45-
libboost-program-options-dev \
46-
libboost-system-dev \
47-
libboost-thread-dev \
48-
libboost-timer-dev \
49-
make \
50-
python3-dev \
51-
unzip \
52-
&& ln -s /usr/bin/python3 /usr/local/bin/python \
53-
&& curl https://bootstrap.pypa.io/get-pip.py | python \
54-
&& pip3 install --no-cache-dir -r conf/requirements-bigartm.txt \
55-
&& git clone --branch v0.10.0 https://github.com/bigartm/bigartm.git /opt/bigartm \
56-
&& mkdir /opt/bigartm/build \
57-
&& cd /opt/bigartm/build \
58-
&& cmake -DINSTALL_PYTHON_PACKAGE=ON -DPYTHON=python3 .. \
59-
&& make -j$(getconf _NPROCESSORS_ONLN) \
60-
&& make install \
61-
&& rm -rf /usr/share/doc /usr/share/man \
62-
&& apt-get autoremove --purge -y \
63-
&& apt-get clean \
64-
&& rm -rf /var/lib/apt/lists/* \
65-
&& mkdir $NLTK_DATA/corpora \
66-
&& curl -sSL https://raw.githubusercontent.com/nltk/nltk_data/gh-pages/packages/corpora/stopwords.zip -o $NLTK_DATA/corpora/stopwords.zip \
67-
&& unzip $NLTK_DATA/corpora/stopwords.zip -d $NLTK_DATA/corpora/ \
68-
&& rm $NLTK_DATA/corpora/stopwords.zip \
34+
RUN ./scripts/install-bigartm \
35+
&& ./scripts/install-tree-sitter \
36+
&& ./scripts/install-nltk-data \
6937
&& pip3 install --no-cache-dir "jupyter == 1.0.0" \
7038
&& pip3 install --no-cache-dir \
7139
"jupyter_contrib_nbextensions == 0.5.1" \
7240
"jupyter_nbextensions_configurator == 0.4.1" \
7341
&& jupyter contrib nbextension install \
7442
&& jupyter nbextensions_configurator enable
7543

76-
COPY jupyter-notebook-config.json /root/.jupyter/nbconfig/notebook.json
77-
COPY jupyter-server-config.json /root/.jupyter/jupyter_notebook_config.json
44+
COPY conf/jupyter-notebook-config.json /root/.jupyter/nbconfig/notebook.json
45+
COPY conf/jupyter-server-config.json /root/.jupyter/jupyter_notebook_config.json
46+
47+
COPY conf/requirements-setup.txt conf/
48+
COPY conf/requirements.txt conf/
7849

79-
COPY requirements*.txt conf/
80-
RUN pip3 install --no-cache-dir -r conf/requirements.txt \
81-
&& pip3 install --no-cache-dir -r conf/requirements-tf.txt
50+
RUN pip3 install --no-cache-dir -r conf/requirements-setup.txt \
51+
&& pip3 install --no-cache-dir -r conf/requirements.txt
8252

83-
WORKDIR /devfest/notebooks
53+
WORKDIR /workdir/notebooks
8454

8555
ENTRYPOINT jupyter notebook --ip 0.0.0.0 --allow-root --no-browser

Makefile

Lines changed: 12 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,25 @@
11
run: jupyter
2+
.PHONY: run
23

34
build-and-run:
45
$(MAKE) jupyter-image
56
$(MAKE) jupyter
7+
.PHONY: build-and-run
68

79
stop:
8-
docker stop devfest_jupyter devfest_gitbase devfest_bblfshd \
9-
> /dev/null 2>&1 || true
10-
11-
bblfshd:
12-
docker start devfest_bblfshd > /dev/null 2>&1 \
13-
|| docker run \
14-
--detach \
15-
--rm \
16-
--name devfest_bblfshd \
17-
--privileged \
18-
--publish 9432:9432 \
19-
--memory 2G \
20-
bblfsh/bblfshd:v2.15.0-drivers \
21-
--log-level DEBUG
22-
23-
gitbase: bblfshd
24-
docker start devfest_gitbase > /dev/null 2>&1 \
25-
|| docker run \
26-
--detach \
27-
--rm \
28-
--name devfest_gitbase \
29-
--publish 3306:3306 \
30-
--link devfest_bblfshd:devfest_bblfshd \
31-
--env BBLFSH_ENDPOINT=devfest_bblfshd:9432 \
32-
--env MAX_MEMORY=1024 \
33-
--volume $(PWD)/repos/git-data:/opt/repos \
34-
srcd/gitbase:v0.24.0-rc2
10+
docker stop mloncode/workshop > /dev/null 2>&1 || true
11+
.PHONY: stop
3512

3613
jupyter-image:
37-
docker build -t mloncode/devfest .
14+
docker build -t mloncode/workshop .
15+
.PHONY: jupyter-image
3816

39-
jupyter: gitbase bblfshd
40-
docker start devfest_jupyter > /dev/null 2>&1 \
17+
jupyter:
18+
docker start mloncode/workshop > /dev/null 2>&1 \
4119
|| docker run \
4220
--rm \
43-
--name devfest_jupyter \
21+
--name mloncode/workshop \
4422
--publish 8888:8888 \
45-
--link devfest_bblfshd:devfest_bblfshd \
46-
--link devfest_gitbase:devfest_gitbase \
47-
--volume $(PWD)/notebooks:/devfest/notebooks \
48-
--volume $(PWD)/repos:/devfest/repos \
49-
mloncode/devfest
50-
51-
52-
.PHONY: run build-and-run stop bblfshd gitbase jupyter-image jupyter
23+
--volume $(PWD)/notebooks:/workdir/notebooks \
24+
mloncode/workshop
25+
.PHONY: jupyter
File renamed without changes.
File renamed without changes.
File renamed without changes.

conf/requirements-bigartm.txt

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#
2+
# This file is autogenerated by pip-compile
3+
# To update, run:
4+
#
5+
# pip-compile requirements-bigartm.in
6+
#
7+
numpy==1.17.2
8+
pandas==0.25.1
9+
protobuf==3.10.0
10+
python-dateutil==2.8.1 # via pandas
11+
pytz==2019.3 # via pandas
12+
scipy==1.3.1
13+
six==1.14.0 # via protobuf, python-dateutil
14+
tqdm==4.36.1
15+
wheel==0.33.6
16+
17+
# The following packages are considered to be unsafe in a requirements file:
18+
# setuptools

conf/requirements-setup.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Cython == 0.29.14

conf/requirements-tree-sitter.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
tree-sitter == 0.0.5

0 commit comments

Comments
 (0)