Skip to content

Commit 9715cfb

Browse files
authored
Merge pull request #934 from hvmzx/calibre-web-kcc
calibre-web-kcc: initial release of kcc mod for calibre-web for comic/manga ebook processing
2 parents 9d6b690 + 46e55ad commit 9715cfb

File tree

22 files changed

+92
-111
lines changed

22 files changed

+92
-111
lines changed

.github/workflows/BuildImage.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ on: [push, pull_request_target, workflow_dispatch]
55
env:
66
GITHUB_REPO: "linuxserver/docker-mods" #don't modify
77
ENDPOINT: "linuxserver/mods" #don't modify
8-
BASEIMAGE: "replace_baseimage" #replace
9-
MODNAME: "replace_modname" #replace
10-
MULTI_ARCH: "true" #set to false if not needed
8+
BASEIMAGE: "calibre-web" #replace
9+
MODNAME: "kcc" #replace
10+
MULTI_ARCH: "false" #set to false if not needed
1111

1212
jobs:
1313
set-vars:
@@ -22,7 +22,7 @@ jobs:
2222
echo "MODNAME=${{ env.MODNAME }}" >> $GITHUB_OUTPUT
2323
echo "MULTI_ARCH=${{ env.MULTI_ARCH }}" >> $GITHUB_OUTPUT
2424
# **** If the mod needs to be versioned, set the versioning logic below. Otherwise leave as is. ****
25-
MOD_VERSION=""
25+
MOD_VERSION="$(curl -s https://api.github.com/repos/ciromattia/kcc/releases/latest | jq -rc ".tag_name")"
2626
echo "MOD_VERSION=${MOD_VERSION}" >> $GITHUB_OUTPUT
2727
outputs:
2828
GITHUB_REPO: ${{ steps.outputs.outputs.GITHUB_REPO }}

Dockerfile

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,38 @@
11
# syntax=docker/dockerfile:1
22

3+
## Buildstage ##
4+
FROM ghcr.io/linuxserver/baseimage-alpine:3.19 AS buildstage
5+
6+
ARG MOD_VERSION
7+
8+
RUN curl -L https://archive.org/download/kindlegen_linux_2_6_i386_v2_9/kindlegen_linux_2.6_i386_v2_9.tar.gz > kindlegen.tar.gz
9+
RUN tar -zxvf kindlegen.tar.gz kindlegen
10+
RUN chmod +rwx 'kindlegen'
11+
RUN rm kindlegen.tar.gz
12+
13+
RUN \
14+
if [ -z ${MOD_VERSION} ]; then \
15+
echo "MOD_VERSION is not set. Fetching from GitHub..."; \
16+
MOD_VERSION=$(curl -s "https://api.github.com/repos/ciromattia/kcc/releases/latest" | jq -rc ".tag_name"); \
17+
else \
18+
echo "MOD_VERSION is already set to '${MOD_VERSION}'"; \
19+
fi && \
20+
echo "Using MOD_VERSION=${MOD_VERSION}" && \
21+
curl -L https://github.com/ciromattia/kcc/archive/refs/tags/${MOD_VERSION}.tar.gz > kcc.tar.gz && \
22+
tar -xzf kcc.tar.gz && \
23+
mv kcc-$(echo "${MOD_VERSION}" | sed 's/^.\(.*\)/\1/') kcc && \
24+
touch kcc/KCC_VERSION && \
25+
echo ${MOD_VERSION} > kcc/KCC_VERSION && \
26+
mkdir -p /root-layer/usr/local/bin && \
27+
mv kindlegen /root-layer/usr/local/bin/ && \
28+
mv kcc /root-layer/usr/local/bin/
29+
30+
COPY root/ /root-layer/
31+
32+
## Single layer deployed image ##
333
FROM scratch
434

5-
LABEL maintainer="username"
35+
LABEL maintainer="hvmzx"
636

7-
# copy local files
8-
COPY root/ /
37+
# Add files from buildstage
38+
COPY --from=buildstage /root-layer/ /

Dockerfile.complex

Lines changed: 0 additions & 33 deletions
This file was deleted.

README.md

Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,7 @@
1-
# Rsync - Docker mod for openssh-server
1+
# KCC (Kindle Comic Converter) - Docker mod for Calibre Web
22

3-
This mod adds rsync to openssh-server, to be installed/updated during container start.
3+
This mod adds KCC and its multitude of ebook processing (upscale, stretch, right to left for manga...) to Calibre Web, to be installed/updated during container start.
44

5-
In openssh-server docker arguments, set an environment variable `DOCKER_MODS=linuxserver/mods:openssh-server-rsync`
5+
In any container docker arguments, set an environment variable `DOCKER_MODS=linuxserver/mods:calibre-web-kcc`
66

7-
If adding multiple mods, enter them in an array separated by `|`, such as `DOCKER_MODS=linuxserver/mods:openssh-server-rsync|linuxserver/mods:openssh-server-mod2`
8-
9-
# Mod creation instructions
10-
11-
* Fork the repo, create a new branch based on the branch `template`.
12-
* Edit the `Dockerfile` for the mod. `Dockerfile.complex` is only an example and included for reference; it should be deleted when done.
13-
* Inspect the `root` folder contents. Edit, add and remove as necessary.
14-
* After all init scripts and services are created, run `find ./ -path "./.git" -prune -o \( -name "run" -o -name "finish" -o -name "check" \) -not -perm -u=x,g=x,o=x -print -exec chmod +x {} +` to fix permissions.
15-
* Edit this readme with pertinent info, delete these instructions.
16-
* Finally edit the `.github/workflows/BuildImage.yml`. Customize the vars for `BASEIMAGE` and `MODNAME`. Set the versioning logic and `MULTI_ARCH` if needed.
17-
* Ask the team to create a new branch named `<baseimagename>-<modname>`. Baseimage should be the name of the image the mod will be applied to. The new branch will be based on the `template` branch.
18-
* Submit PR against the branch created by the team.
19-
20-
21-
## Tips and tricks
22-
23-
* Some images have helpers built in, these images are currently:
24-
* [Openvscode-server](https://github.com/linuxserver/docker-openvscode-server/pull/10/files)
25-
* [Code-server](https://github.com/linuxserver/docker-code-server/pull/95)
7+
If adding multiple mods, enter them in an array separated by `|`, such as `DOCKER_MODS=linuxserver/mods:calibre-web-kcc|linuxserver/mods:calibre-web-mod2`

root/etc/s6-overlay/s6-rc.d/init-mod-imagename-modname-add-package/dependencies.d/init-mods renamed to root/etc/s6-overlay/s6-rc.d/init-mod-calibre-web-kcc-add-package/dependencies.d/init-mods

File renamed without changes.
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
#!/usr/bin/with-contenv bash
2+
3+
echo "**** Adding kcc dependencies (repo and pip) to package install lists ****"
4+
if ! python3 /usr/local/bin/kcc/kcc-c2e.py > /dev/null 2>&1 ; then
5+
echo "\
6+
PySide6 \
7+
Pillow \
8+
psutil \
9+
requests \
10+
python-slugify \
11+
raven \
12+
mozjpeg-lossless-optimization \
13+
natsort[fast] \
14+
distro" >> /mod-pip-packages-to-install.list
15+
## Ubuntu
16+
if [ -f /usr/bin/apt ]; then
17+
echo "\
18+
python3 \
19+
python3-pip
20+
python3-dev \
21+
libpng-dev \
22+
libjpeg-dev \
23+
p7zip-full \
24+
p7zip-rar \
25+
unrar-free \
26+
libgl1 \
27+
python3-pyqt5 \
28+
cmake" >> /mod-repo-packages-to-install.list
29+
fi
30+
# Alpine
31+
if [ -f /sbin/apk ]; then
32+
echo "\
33+
cargo \
34+
libffi-dev \
35+
openssl-dev \
36+
python3 \
37+
python3-dev \
38+
python3 \
39+
py3-pip \
40+
libpng-dev \
41+
libjpeg \
42+
p7zip \
43+
unrar \
44+
mesa-gl \
45+
py3-qt5 \
46+
cmake" >> /mod-repo-packages-to-install.list
47+
fi
48+
else
49+
echo "**** kcc dependencies already installed, skipping ****"
50+
fi

root/etc/s6-overlay/s6-rc.d/init-mod-imagename-modname-add-package/type renamed to root/etc/s6-overlay/s6-rc.d/init-mod-calibre-web-kcc-add-package/type

File renamed without changes.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/etc/s6-overlay/s6-rc.d/init-mod-calibre-web-kcc-add-package/run

root/etc/s6-overlay/s6-rc.d/init-mod-imagename-modname-add-package/run

Lines changed: 0 additions & 30 deletions
This file was deleted.

root/etc/s6-overlay/s6-rc.d/init-mod-imagename-modname-add-package/up

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)