Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

+ added docker image with supervisord #6

Merged
merged 2 commits into from
Oct 31, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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