Adds Docker support

This commit is contained in:
Nemo 2020-01-16 14:14:41 +05:30
parent 1491153452
commit 2969530996
4 changed files with 34 additions and 2 deletions

2
.dockerignore Normal file
View File

@ -0,0 +1,2 @@
node_modules/
TODO.md

13
Dockerfile Normal file
View File

@ -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"]

View File

@ -1,6 +1,6 @@
# url-to-epub # 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: 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 ## 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: You will need `pandoc` and `npm` installed. To install this script globally:
npm install --global url-to-epub 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. 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`. You can check that directory by running `npm bin --global`.
### Docker
`docker pull captn3m0/url-to-epub:latest`
## Usage ## Usage
### NPM
``` ```
url-to-epub <url> url-to-epub <url>
@ -67,6 +77,12 @@ Examples:
"https://www.tor.com/2019/02/06/articulated-restraint-mary-robinette-kowal/" "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 ## HACKING
There is a list of planned items in [TODO.md](TODO.md). There is a list of planned items in [TODO.md](TODO.md).

View File

@ -6,4 +6,5 @@ General ideas for improvement of the script:
4. Remove pandoc dependency 4. Remove pandoc dependency
5. Optionally support <https://github.com/mozilla/readability> instead of article-parser. Mozilla's engine is much better. 5. Optionally support <https://github.com/mozilla/readability> instead of article-parser. Mozilla's engine is much better.
6. Add more EPUB metadata tag support 6. Add more EPUB metadata tag support
7. Pick up the language automatically 7. Pick up the language automatically
8. Better error message without pandoc