forked from ijmarshall/robotsearch
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
69 lines (58 loc) · 2.3 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
FROM ubuntu:16.04
ENV DEBIAN_FRONTEND noninteractive
# create deploy user
RUN useradd --create-home --home /var/lib/deploy deploy
# install apt-get requirements
ADD apt-requirements.txt /tmp/apt-requirements.txt
RUN apt-get -qq update -y
RUN xargs -a /tmp/apt-requirements.txt apt-get install -y --no-install-recommends && apt-get clean
# Certs
RUN mkdir -p /etc/pki/tls/certs && \
ln -s /etc/ssl/certs/ca-certificates.crt /etc/pki/tls/certs/ca-bundle.crt
# node.js and utils
RUN add-apt-repository ppa:chris-lea/node.js
RUN apt-get install -y nodejs npm && npm update
ENV NODE_PATH $NODE_PATH:/usr/local/lib/node_modules
RUN npm install -g requirejs
RUN ln -s /usr/bin/nodejs /usr/bin/node
#RUN cd /var/lib/deploy/ && wget https://github.com/kermitt2/grobid/archive/grobid-parent-0.4.1.zip -O grobid.zip && \
# unzip grobid.zip && \
# cd /var/lib/deploy/grobid-grobid-parent-0.4.1 && \
# mvn -Dmaven.test.skip=true clean install && \
# rm -f /var/lib/deploy/grobid.zip
RUN chown -R deploy.deploy /var/lib/deploy/
USER deploy
# install Anaconda
RUN curl https://repo.continuum.io/archive/Anaconda3-2019.03-Linux-x86_64.sh -o /var/lib/deploy/Anaconda.sh
RUN cd /var/lib/deploy && bash Anaconda.sh -b && rm -rf Anaconda.sh
ENV PATH=/var/lib/deploy/anaconda3/bin:$PATH
ADD rs_env.yml tmp/rs_env.yml
RUN conda env create -f tmp/rs_env.yml
# from https://stackoverflow.com/questions/37945759/condas-source-activate-virtualenv-does-not-work-within-dockerfile
ENV PATH /var/lib/deploy/anaconda3/envs/robotsearch/bin:$PATH
#RUN python -m nltk.downloader punkt stopwords
#RUN python -m spacy.en.download all
# Get data
USER root
RUN mkdir -p /var/lib/deploy/robotsearch/data
ADD server.py /var/lib/deploy/
ADD rr_web.py /var/lib/deploy/
ADD run /var/lib/deploy/
ADD robotsearch /var/lib/deploy/robotsearch
ADD filtered /var/lib/deploy/filtered
ADD static /var/lib/deploy/static
ADD templates /var/lib/deploy/templates
ADD uploads //var/lib/deploy/uploads
RUN chown -R deploy.deploy /var/lib/deploy/robotsearch
USER deploy
VOLUME /var/lib/deploy/src/robotsearch/data
# compile client side assets
#RUN cd /var/lib/deploy/robotsearch/ && \
# r.js -o static/build.js && \
# mv static static.bak && \
# mv build static && \
# rm -rf static.bak
EXPOSE 5000
ENV HOME /var/lib/deploy
USER root
ENTRYPOINT ["/var/lib/deploy/run"]