diff options
| -rw-r--r-- | Dockerfile | 37 | ||||
| -rw-r--r-- | README.md | 10 |
2 files changed, 28 insertions, 19 deletions
@@ -1,24 +1,33 @@ -FROM python:3.7-stretch +FROM golang:stretch AS rmapi -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} +ENV GOPATH /go +ENV PATH ${GOPATH}/bin:/usr/local/go/bin:$PATH +ENV RMAPIREPO github.com/juruen/rmapi + +RUN go get -u ${RMAPIREPO} + + +FROM python:3.7-slim-stretch # 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 +COPY --from=rmapi /go/bin/rmapi /usr/bin/rmapi -# pdftk & pdfcrop +# imagemagick, pdftk, ghostscript, pdfcrop RUN apt-get update \ - && apt-get install -y \ + && apt-get install --no-install-recommends -y \ + libmagickwand-dev \ pdftk \ + ghostscript \ texlive-extra-utils # contains pdfcrop -RUN pip install paper2remarkable +RUN pip install --no-cache-dir paper2remarkable + +RUN useradd -u 1000 -m -U user + +USER user + +ENV USER user + +WORKDIR /home/user ENTRYPOINT ["p2r"] @@ -133,7 +133,7 @@ First clone this repository with `git clone` and `cd` inside of it, then build the container: ```bash -docker build -t paper2remarkable . +docker build -t p2r . ``` ### Authorization @@ -143,7 +143,7 @@ we'll use `rmapi` to create it. ```bash touch ${HOME}/.rmapi -docker run --rm -i -t -v "${HOME}/.rmapi:/root/.rmapi:rw" --entrypoint=rmapi paper2remarkable version +docker run --rm -i -t -v "${HOME}/.rmapi:/home/user/.rmapi:rw" --entrypoint=rmapi p2r version ``` which should end with output like @@ -156,14 +156,14 @@ rmapi version: 0.0.5 ### Usage Use the container by replacing `p2r` with `docker run --rm -v -"${HOME}/.rmapi:/root/.rmapi:rw" paper2remarkable`, e.g. +"${HOME}/.rmapi:/home/user/.rmapi:rw" p2r`, e.g. ``` # print help and exit -docker run --rm -v "${HOME}/.rmapi:/root/.rmapi:rw" paper2remarkable --help +docker run --rm -v "${HOME}/.rmapi:/home/user/.rmapi:rw" p2r --help # equivalent to above usage via `python` -docker run --rm -v "${HOME}/.rmapi:/root/.rmapi:rw" paper2remarkable -v https://arxiv.org/abs/1811.11242 +docker run --rm -v "${HOME}/.rmapi:/home/user/.rmapi:rw" p2r -v https://arxiv.org/abs/1811.11242 ``` # Notes |
