From 5dccfbeeec3bf56e2bceb7d3a60bd0dd57f6c363 Mon Sep 17 00:00:00 2001 From: GregHilston Date: Thu, 30 Nov 2023 22:28:50 -0500 Subject: [PATCH 1/3] feat: add Docker support, and documentation for it --- Dockerfile | 19 +++++++++++++++++++ README.md | 17 +++++++++++++++++ docker-compose.yaml | 9 +++++++++ 3 files changed, 45 insertions(+) create mode 100644 Dockerfile create mode 100644 README.md create mode 100644 docker-compose.yaml diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..c2ff187 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,19 @@ +FROM node:16 + +# Create app directory +WORKDIR /usr/src/app + +# Install app dependencies +# A wildcard is used to ensure both package.json AND package-lock.json are copied +# where available (npm@5+) +COPY package*.json ./ + +# Download, and prepare the kepubify binary +RUN wget https://github.com/pgaskin/kepubify/releases/download/v4.0.4/kepubify-linux-64bit +RUN mv kepubify-linux-64bit /usr/local/bin/kepubify +RUN chmod +x /usr/local/bin/kepubify + +COPY . . + +EXPOSE 3001 +CMD [ "node", "index" ] diff --git a/README.md b/README.md new file mode 100644 index 0000000..ca0d58c --- /dev/null +++ b/README.md @@ -0,0 +1,17 @@ +# send2ereader + +A self hostable service for sending ebooks to a Kobo or Kindle ereader through the built-in browser. + +## How To Run + +### On Your Host OS + +1. Have Node 16 installed +2. Install this service's dependencies by running `$ npm install` +3. Install [Kepubify](https://github.com/pgaskin/kepubify), and have the executable in your path. +4. Start this service by running: `$ node index` + +### Containerized + +1. Have Docker installed +2. Run `$ docker compose up` diff --git a/docker-compose.yaml b/docker-compose.yaml new file mode 100644 index 0000000..c1343a0 --- /dev/null +++ b/docker-compose.yaml @@ -0,0 +1,9 @@ +version: "3" +services: + send2ereader: + build: + context: . + dockerfile: ./Dockerfile + container_name: send3ereader + ports: + - 3001:3001 From 366282b460329f640d1fadc5db54ad33edda0037 Mon Sep 17 00:00:00 2001 From: daniel-j Date: Tue, 5 Dec 2023 21:01:31 +0100 Subject: [PATCH 2/3] add kindlegen, update node, more robust Dockerfile --- .dockerignore | 3 +++ Dockerfile | 30 ++++++++++++++++++++---------- docker-compose.yaml | 2 +- 3 files changed, 24 insertions(+), 11 deletions(-) create mode 100644 .dockerignore diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..0d16104 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,3 @@ +.git +/uploads +/node_modules diff --git a/Dockerfile b/Dockerfile index c2ff187..3589681 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,19 +1,29 @@ -FROM node:16 +FROM node:20 # Create app directory WORKDIR /usr/src/app +# Copy app files (see .dockerignore) +COPY . ./ + # Install app dependencies -# A wildcard is used to ensure both package.json AND package-lock.json are copied -# where available (npm@5+) -COPY package*.json ./ +RUN npm install --omit=dev -# Download, and prepare the kepubify binary -RUN wget https://github.com/pgaskin/kepubify/releases/download/v4.0.4/kepubify-linux-64bit -RUN mv kepubify-linux-64bit /usr/local/bin/kepubify -RUN chmod +x /usr/local/bin/kepubify +# Download and install kepubify +RUN wget https://github.com/pgaskin/kepubify/releases/download/v4.0.4/kepubify-linux-64bit && \ + mv kepubify-linux-64bit /usr/local/bin/kepubify && \ + chmod +x /usr/local/bin/kepubify -COPY . . +# Download and install kindlegen +RUN wget https://archive.org/download/kindlegen2.9/kindlegen_linux_2.6_i386_v2_9.tar.gz && \ + mkdir kindlegen && \ + tar xvf kindlegen_linux_2.6_i386_v2_9.tar.gz --directory kindlegen && \ + cp kindlegen/kindlegen /usr/local/bin/kindlegen && \ + chmod +x /usr/local/bin/kindlegen && \ + rm -rf kindlegen + +# Create uploads directory if it doesn't exist +RUN mkdir uploads EXPOSE 3001 -CMD [ "node", "index" ] +CMD [ "npm", "start" ] diff --git a/docker-compose.yaml b/docker-compose.yaml index c1343a0..6b1a111 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -4,6 +4,6 @@ services: build: context: . dockerfile: ./Dockerfile - container_name: send3ereader + container_name: send2ereader ports: - 3001:3001 From c167d4662ba719b443b506989f48f78a9fa4dee7 Mon Sep 17 00:00:00 2001 From: daniel-j Date: Tue, 5 Dec 2023 21:06:12 +0100 Subject: [PATCH 3/3] update readme --- README.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index ca0d58c..27377a3 100644 --- a/README.md +++ b/README.md @@ -6,12 +6,14 @@ A self hostable service for sending ebooks to a Kobo or Kindle ereader through t ### On Your Host OS -1. Have Node 16 installed +1. Have Node.js 16 or 20 installed 2. Install this service's dependencies by running `$ npm install` -3. Install [Kepubify](https://github.com/pgaskin/kepubify), and have the executable in your path. -4. Start this service by running: `$ node index` +3. Install [Kepubify](https://github.com/pgaskin/kepubify), and have the kepubify executable in your PATH. +4. Install [KindleGen](https://archive.org/details/kindlegen2.9), and have the kindlegen executable in your PATH. +5. Start this service by running: `$ npm start` and access it on HTTP port 3001 ### Containerized 1. Have Docker installed 2. Run `$ docker compose up` +3. Access the service on HTTP port 3001