diff options
| author | Gertjan van den Burg <gertjanvandenburg@gmail.com> | 2019-09-02 12:23:08 +0100 |
|---|---|---|
| committer | Gertjan van den Burg <gertjanvandenburg@gmail.com> | 2019-09-02 12:23:08 +0100 |
| commit | dbfc4d7139171e5447fbd8034d246cd09e62e277 (patch) | |
| tree | 0d65ca420467dd86cf9e3e3a347d4d73d3faa234 | |
| parent | minor bugfix for springer provider (diff) | |
| parent | Add Docker section to README. (diff) | |
| download | paper2remarkable-dbfc4d7139171e5447fbd8034d246cd09e62e277.tar.gz paper2remarkable-dbfc4d7139171e5447fbd8034d246cd09e62e277.zip | |
Merge branch 'ClaytonJY-dockerize'
| -rw-r--r-- | Dockerfile | 32 | ||||
| -rw-r--r-- | README.md | 37 |
2 files changed, 69 insertions, 0 deletions
diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..6578db3 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,32 @@ +FROM python:3.7-stretch + +ENV GO_VERSION 1.12.9 +ENV GO_TAR go${GO_VERSION}.linux-amd64.tar.gz +ENV GOROOT /usr/local/go +ENV GOPATH /root/go +ENV PATH ${GOPATH}/bin:${GOROOT}/bin:${PATH} + +# rmapi +RUN wget https://dl.google.com/go/${GO_TAR} \ + && tar -xf ${GO_TAR} \ + && mv go ${GOROOT} \ + && rm ${GO_TAR} \ + && go get -u github.com/juruen/rmapi + +# pdftk & pdfcrop +RUN apt-get update \ + && apt-get install -y \ + pdftk \ + texlive-extra-utils # contains pdfcrop + +RUN pip install \ + bs4 \ + requests \ + PyPDF2 \ + titlecase \ + pdfplumber \ + unidecode + +COPY arxiv2remarkable.py ./ + +ENTRYPOINT ["python", "arxiv2remarkable.py"] @@ -117,6 +117,43 @@ you can use ``pip`` with the following command: pip install --user bs4 requests PyPDF2 titlecase pdfplumber unidecode ``` +## Docker + +You can also use our Dockerfile to avoid installing dependencies on your machine. You will need `git` and `docker` installed. + +First clone this repository with `git clone` and `cd` inside of it, then build the container: + +```bash +docker build -t arxiv2remarkable . +``` + +### Authorization + +If you already have a `~/.rmapi` file, you can skip this section. Otherwise we'll use `rmapi` to create it. + +```bash +touch ${HOME}/.rmapi +docker run --rm --it -v "${HOME}/.rmapi:/root/.rmapi:rw" --entrypoint=rmapi arxiv2remarkable version +``` + +which should end with output like + +```bash +ReMarkable Cloud API Shell +rmapi version: 0.0.5 +``` + +### Usage + +Use the container by replacing `python arxiv2remarkable.py` with `docker run --rm -v "${HOME}/.rmapi:/root/.rmapi:rw" arxiv2remarkable`, e.g. +``` +# print help and exit +docker run --rm -v "${HOME}/.rmapi:/root/.rmapi:rw" arxiv2remarkable --help + +# equivalent to above usage via `python` +docker run --rm -v "${HOME}/.rmapi:/root/.rmapi:rw" arxiv2remarkable -v https://arxiv.org/abs/1811.11242 +``` + # Notes License: MIT |
