Skip to content

Commit 8b48000

Browse files
committed
Catch up versions, add CI
1 parent afd4439 commit 8b48000

File tree

3 files changed

+38
-11
lines changed

3 files changed

+38
-11
lines changed

.github/workflows/docker.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: Publish Docker image
2+
on:
3+
release:
4+
types: [published]
5+
jobs:
6+
push_to_registry:
7+
name: Push Docker image to Docker Hub
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: Check out the repo
11+
uses: actions/checkout@v2
12+
- name: Push to Docker Hub
13+
uses: docker/build-push-action@v1
14+
with:
15+
username: ${{ secrets.DOCKER_USERNAME }}
16+
password: ${{ secrets.DOCKER_PASSWORD }}
17+
repository: chilland/corenlp
18+
tag_with_ref: true

Dockerfile

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,13 @@ FROM maven:alpine
33
RUN apk add --update --no-cache \
44
unzip wget
55

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

10-
WORKDIR stanford-corenlp-full-2018-02-27
8+
RUN wget http://nlp.stanford.edu/software/stanford-corenlp-${CORENLP_VERSION}.zip
9+
RUN unzip stanford-corenlp-${CORENLP_VERSION}.zip && \
10+
rm stanford-corenlp-${CORENLP_VERSION}.zip
11+
12+
WORKDIR stanford-corenlp-${CORENLP_VERSION}
1113

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

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

19-
ENV PORT 9000
20-
21-
EXPOSE $PORT
21+
EXPOSE 9000
2222

23-
CMD java -cp "*" -mx4g edu.stanford.nlp.pipeline.StanfordCoreNLPServer -port \
24-
$PORT -parse.model edu/stanford/nlp/models/srparser/englishSR.ser.gz
23+
CMD java -cp "*" -mx4g edu.stanford.nlp.pipeline.StanfordCoreNLPServer -parse.model edu/stanford/nlp/models/srparser/englishSR.ser.gz

README.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,20 @@ Dockerfile for Stanford CoreNLP Server
55
This Dockerfile builds the [Stanford CoreNLP
66
Server](http://stanfordnlp.github.io/CoreNLP/corenlp-server.html) and
77
shift-reduce parser. It exposes the endpoint on port 9000. Requests
8-
are made as covered in the documentation.
8+
are made as covered in the documentation. Including the shift-reduce parser
9+
makes the image rather large (2.5gb+). You can specify the version you want to
10+
build via `--build-arg`.
911

1012
## Build
1113

1214
```shell
13-
docker build -t corenlp:3.9.1 .
15+
docker build --build-arg CORENLP_VERSION=${CORENLP_VERSION} -t corenlp:${CORENLP_VERSION} .
16+
```
17+
18+
## Run
19+
The container runs the server with some simple defaults and runs the jar with
20+
4gb of memory. The command can be overriden when you start the container. For
21+
example:
22+
```shell
23+
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
1424
```

0 commit comments

Comments
 (0)