Skip to content

Commit

Permalink
Catch up versions, add CI
Browse files Browse the repository at this point in the history
  • Loading branch information
chilland committed Dec 10, 2020
1 parent afd4439 commit 8b48000
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 11 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Publish Docker image
on:
release:
types: [published]
jobs:
push_to_registry:
name: Push Docker image to Docker Hub
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v2
- name: Push to Docker Hub
uses: docker/build-push-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
repository: chilland/corenlp
tag_with_ref: true
17 changes: 8 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@ FROM maven:alpine
RUN apk add --update --no-cache \
unzip wget

RUN wget http://nlp.stanford.edu/software/stanford-corenlp-full-2018-02-27.zip
RUN unzip stanford-corenlp-full-2018-02-27.zip && \
rm stanford-corenlp-full-2018-02-27.zip
ARG CORENLP_VERSION="4.2.0"

WORKDIR stanford-corenlp-full-2018-02-27
RUN wget http://nlp.stanford.edu/software/stanford-corenlp-${CORENLP_VERSION}.zip
RUN unzip stanford-corenlp-${CORENLP_VERSION}.zip && \
rm stanford-corenlp-${CORENLP_VERSION}.zip

WORKDIR stanford-corenlp-${CORENLP_VERSION}

RUN wget https://nlp.stanford.edu/software/stanford-srparser-2014-10-23-models.jar
RUN mvn install:install-file -Dfile=stanford-srparser-2014-10-23-models.jar \
Expand All @@ -16,9 +18,6 @@ RUN mvn install:install-file -Dfile=stanford-srparser-2014-10-23-models.jar \

RUN export CLASSPATH="`find . -name '*.jar'`"

ENV PORT 9000

EXPOSE $PORT
EXPOSE 9000

CMD java -cp "*" -mx4g edu.stanford.nlp.pipeline.StanfordCoreNLPServer -port \
$PORT -parse.model edu/stanford/nlp/models/srparser/englishSR.ser.gz
CMD java -cp "*" -mx4g edu.stanford.nlp.pipeline.StanfordCoreNLPServer -parse.model edu/stanford/nlp/models/srparser/englishSR.ser.gz
14 changes: 12 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,20 @@ Dockerfile for Stanford CoreNLP Server
This Dockerfile builds the [Stanford CoreNLP
Server](http://stanfordnlp.github.io/CoreNLP/corenlp-server.html) and
shift-reduce parser. It exposes the endpoint on port 9000. Requests
are made as covered in the documentation.
are made as covered in the documentation. Including the shift-reduce parser
makes the image rather large (2.5gb+). You can specify the version you want to
build via `--build-arg`.

## Build

```shell
docker build -t corenlp:3.9.1 .
docker build --build-arg CORENLP_VERSION=${CORENLP_VERSION} -t corenlp:${CORENLP_VERSION} .
```

## Run
The container runs the server with some simple defaults and runs the jar with
4gb of memory. The command can be overriden when you start the container. For
example:
```shell
docker run -p 9000:9000 -d corenlp java -cp "*" -mx15g edu.stanford.nlp.pipeline.StanfordCoreNLPServer -parse.model edu/stanford/nlp/models/srparser/englishSR.ser.gz -preload tokenize,ssplit,pos,lemma,depparse,ner,kbp,relation,coref,quote,sentiment -quiet
```

0 comments on commit 8b48000

Please sign in to comment.