From 32c193a1ae35449bf3e8ca04dbf3636ffb874135 Mon Sep 17 00:00:00 2001 From: Vitali Peil Date: Mon, 25 Feb 2019 16:41:40 +0100 Subject: [PATCH] introduce Dockerfile to project --- Dockerfile | 31 +++++++++++++++++++++++++++++++ README.md | 10 +++++++++- docker/local.json | 12 ++++++++++++ 3 files changed, 52 insertions(+), 1 deletion(-) create mode 100644 Dockerfile create mode 100644 docker/local.json diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..264dda86 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,31 @@ +# Docker image for citeproc-node app + +FROM node +MAINTAINER + +# append nodejs binaries TO PATH +ENV PATH node_modules/.bin:$PATH + +# Add source +COPY . citeproc-js-server + +WORKDIR citeproc-js-server + +# fetch git submodules +RUN git submodule init +RUN git submodule update + +RUN npm install + +# XML to JSON for optimal performance +RUN ./xmltojson.py ./csl ./csl-json +RUN ./xmltojson.py ./csl-locales ./csl-locales-json + +# Override configuration to match above paths +ADD docker/local.json config/local.json + +# Expose port +EXPOSE 8085 + +# run app +CMD ["npm", "start"] diff --git a/README.md b/README.md index d93d7eaf..857cf561 100644 --- a/README.md +++ b/README.md @@ -23,6 +23,14 @@ Also note that the citation server automatically watches the style and locale di to automatically use the new versions when they're pulled. This is subject to [platform caveats](https://nodejs.org/api/fs.html#fs_caveats) +## Setting up citeproc-js-server using docker + +With docker running the citeproc-js-server is easy. Just execute the command + +``` +docker run -d -p 8085:8085 +``` + ## Setting up citeproc-js-server ### Step 1 @@ -49,7 +57,7 @@ If all is well, you will see: info Server running at http://127.0.0.1:8085 ``` -### Step 3 +## Test your citeproc-js-server Now to test the server using the sampledata.json file provided in the citeproc-js-server sources. Try posting it to your server, from a separate diff --git a/docker/local.json b/docker/local.json new file mode 100644 index 00000000..d58b86ce --- /dev/null +++ b/docker/local.json @@ -0,0 +1,12 @@ +{ + "port" : 8085, + "logLevel" : "info", + "localesPath" : "./csl-locales-json", + "cslPath" : "./csl-json", + "renamedStylesPath": "./csl/renamed-styles.json", + "cslDependentPath": "./csl/dependent", + "engineCacheSize" : 40, + "timings": false, + "debug": true, + "userAgent": "Zotero Citation Server (https://github.com/zotero/citeproc-js-server)" +} \ No newline at end of file