Skip to content

Commit

Permalink
Merge pull request #6 from Surt/master
Browse files Browse the repository at this point in the history
+ added docker image with supervisord
  • Loading branch information
web64 authored Oct 31, 2020
2 parents 623db3b + c2e4d99 commit dbf8714
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 0 deletions.
33 changes: 33 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Use the official image as a parent image.
FROM python:3.8.5-slim-buster

RUN apt-get update && \
apt-get upgrade -y && \
apt-get install -y git && \
apt-get install -y supervisor

# Set the working directory.
WORKDIR /usr/src
RUN git clone https://github.com/web64/nlpserver.git
WORKDIR /usr/src/nlpserver

# Install dependencies
RUN apt-get -y install pkg-config && \
apt-get -y install -y python-numpy libicu-dev && \
apt-get -y install -y python3-pip && \
python3 -m pip install -r requirements.txt

# Download language models
RUN polyglot download LANG:en

RUN python3 -m spacy download en && \
python3 -m spacy download xx

# Set supervisor config
COPY nlpserver.conf /etc/supervisor/conf.d
COPY entrypoint.sh /usr/local/bin/
RUN chmod +x /usr/local/bin/entrypoint.sh

ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]

EXPOSE 6400
18 changes: 18 additions & 0 deletions docker/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# NLP Server Docker image

Docker slim image with NLP Server

## Image creation

Inside the docker folder run
```
docker build . --tag nlpserver:1.0
docker run --publish 6400:6400 --detach --name nlpserver nlpserver:1.0
```

For CoreNLP on another container run:
```
docker run -p 9000:9000 nlpbox/corenlp
```
5 changes: 5 additions & 0 deletions docker/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash
/usr/bin/supervisord -n -c /etc/supervisor/supervisord.conf
supervisorctl reread
supervisorctl update
supervisorctl start nlpserver
7 changes: 7 additions & 0 deletions docker/nlpserver.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[program:nlpserver]
command=python3 /usr/src/nlpserver/nlpserver.py
directory=/usr/src/nlpserver/
autostart=true
autorestart=unexpected
stdout_logfile=/var/log/nlpserver.log
stderr_logfile=/var/log/nlpserver-error.log

0 comments on commit dbf8714

Please sign in to comment.