From 296953099681a6923f62541899a47a3c601cb720 Mon Sep 17 00:00:00 2001 From: Nemo Date: Thu, 16 Jan 2020 14:14:41 +0530 Subject: [PATCH] Adds Docker support --- .dockerignore | 2 ++ Dockerfile | 13 +++++++++++++ README.md | 18 +++++++++++++++++- TODO.md | 3 ++- 4 files changed, 34 insertions(+), 2 deletions(-) create mode 100644 .dockerignore create mode 100644 Dockerfile diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..ee257fa --- /dev/null +++ b/.dockerignore @@ -0,0 +1,2 @@ +node_modules/ +TODO.md \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..7c234b1 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,13 @@ +FROM node:10-slim + +VOLUME /data + +COPY . /app + +WORKDIR /app + +RUN npm ci && npm link + +RUN apt-get update && apt-get install --yes pandoc + +ENTRYPOINT ["/usr/local/bin/url-to-epub"] \ No newline at end of file diff --git a/README.md b/README.md index 573c59a..87bd44c 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # url-to-epub -![npm](https://img.shields.io/npm/v/url-to-epub?style=flat-square) +![npm](https://img.shields.io/npm/v/url-to-epub?style=flat-square) ![Docker Build Status](https://img.shields.io/docker/build/captn3m0/url-to-epub?style=flat-square) ![GitHub issues](https://img.shields.io/github/issues/captn3m0/url-to-epub) ![Docker Pulls](https://img.shields.io/docker/pulls/captn3m0/url-to-epub?style=flat-square) ![npm bundle size](https://img.shields.io/bundlephobia/min/url-to-epub?style=flat-square) A simple script that generates an EPUB from a single URL, taking care for the following: @@ -10,6 +10,10 @@ A simple script that generates an EPUB from a single URL, taking care for the fo ## Installation +You can either run this script as an NPM package, or as a docker container. + +### NPM + You will need `pandoc` and `npm` installed. To install this script globally: npm install --global url-to-epub @@ -17,8 +21,14 @@ You will need `pandoc` and `npm` installed. To install this script globally: Please make sure that the global node_modules/bin directory is added to your PATH. You can check that directory by running `npm bin --global`. +### Docker + +`docker pull captn3m0/url-to-epub:latest` + ## Usage +### NPM + ``` url-to-epub @@ -67,6 +77,12 @@ Examples: "https://www.tor.com/2019/02/06/articulated-restraint-mary-robinette-kowal/" ``` +### Docker + + docker run --user $UID --volume /tmp:/data captn3m0/url-to-epub:latest --output /data/articulated-restraint.epub --cover-url https://i.gr-assets.com/images/S/compressed.photo.goodreads.com/books/1548962694l/43782466._SY475_.jpg https://www.tor.com/2019/02/06/articulated-restraint-mary-robinette-kowal/ + +The generated file will be available in `/data/articulated-restraint.epub`. + ## HACKING There is a list of planned items in [TODO.md](TODO.md). diff --git a/TODO.md b/TODO.md index 7bdd4e1..d196466 100644 --- a/TODO.md +++ b/TODO.md @@ -6,4 +6,5 @@ General ideas for improvement of the script: 4. Remove pandoc dependency 5. Optionally support instead of article-parser. Mozilla's engine is much better. 6. Add more EPUB metadata tag support -7. Pick up the language automatically \ No newline at end of file +7. Pick up the language automatically +8. Better error message without pandoc \ No newline at end of file