-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
53 lines (38 loc) · 1.57 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
FROM ubuntu:20.04
LABEL author="[email protected]"
LABEL maintainer="[email protected]"
# Setup python and java and base system
ENV DEBIAN_FRONTEND noninteractive
ENV LANG=en_US.UTF-8
# Install JDK (for CoreNLP) and Python3
RUN apt-get update && \
apt-get upgrade -y && \
apt-get install -q -y openjdk-8-jdk python3-pip libsnappy-dev language-pack-en wget unzip
# Install packages
RUN pip3 install --upgrade --no-cache-dir pip requests nl4dv
# Download artefacts for Spacy and NLTK
RUN python3 -m spacy download en_core_web_sm \
&& python3 -m nltk.downloader popular
# Copy start script
COPY ./start.sh /start.sh
RUN chmod +x /start.sh
# Copy Gunicorn config file
COPY ./gunicorn_conf.py /gunicorn_conf.py
# Copy NL4DV-specific files, namely the API end points, data assets, etc.
COPY ./app /app
# Install Requirements
RUN pip3 install -r /app/requirements.txt
# Download the English model of Stanford CoreNLP
RUN wget "https://nlp.stanford.edu/software/stanford-english-corenlp-2018-10-05-models.jar" -P /app/assets/jars/
# Download and Extract the Stanford Parser to the jars directory
RUN wget "https://nlp.stanford.edu/software/stanford-parser-full-2018-10-17.zip" -P /opt \
&& unzip /opt/stanford-parser-full-2018-10-17.zip -d /opt \
&& cp /opt/stanford-parser-full-2018-10-17/stanford-parser.jar /app/assets/jars/
# Set Working Directory. For relative paths inside the container main.py
WORKDIR /app
# Set PythonPath
ENV PYTHONPATH=/app
# Expose container port 80
EXPOSE 80
# Run the start script; it will start Gunicorn with Uvicorn
CMD ["/start.sh"]