mirror of
https://github.com/ciromattia/kcc
synced 2026-04-18 23:19:00 +00:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d2981c0ceb | ||
|
|
8268552ac7 |
45
.github/workflows/docker-base-publish.yml
vendored
Normal file
45
.github/workflows/docker-base-publish.yml
vendored
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
name: Build and Publish Base Docker Image
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
|
||||||
|
paths:
|
||||||
|
- 'requirements-docker.txt'
|
||||||
|
- 'Dockerfile-base'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build_and_publish_base_image:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Login to GitHub Container Registry
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
registry: ghcr.io
|
||||||
|
username: ${{ github.repository_owner }}
|
||||||
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Set up QEMU
|
||||||
|
uses: docker/setup-qemu-action@v3
|
||||||
|
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
|
- name: Set Release Date
|
||||||
|
id: release_date
|
||||||
|
run: |
|
||||||
|
echo "release_date=$(date --rfc-3339=date)" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
- name: Build and push
|
||||||
|
uses: docker/build-push-action@v6
|
||||||
|
with:
|
||||||
|
platforms: linux/amd64,linux/arm64,linux/arm/v7
|
||||||
|
file: Dockerfile-base
|
||||||
|
push: true
|
||||||
|
tags: |
|
||||||
|
ghcr.io/${{ github.repository_owner }}/kcc:base-latest
|
||||||
|
ghcr.io/${{ github.repository_owner }}/kcc:base-${{ steps.release_date.outputs.release_date }}
|
||||||
|
cache-from: type=registry,ref=ghcr.io/${{ github.repository_owner }}/kcc:base-cache
|
||||||
|
cache-to: type=registry,ref=ghcr.io/${{ github.repository_owner }}/kcc:base-cache,mode=max
|
||||||
32
.github/workflows/docker-publish.yml
vendored
32
.github/workflows/docker-publish.yml
vendored
@@ -1,4 +1,4 @@
|
|||||||
name: Build and Publish Docker Image
|
name: Build and publish final image
|
||||||
|
|
||||||
on:
|
on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
@@ -6,7 +6,7 @@ on:
|
|||||||
tags:
|
tags:
|
||||||
- 'v*.*.*'
|
- 'v*.*.*'
|
||||||
|
|
||||||
# Don't trigger if it's just a documentation update
|
# Don't trigger if it's just a documentation update or a base image update
|
||||||
paths-ignore:
|
paths-ignore:
|
||||||
- '**.md'
|
- '**.md'
|
||||||
- '**.MD'
|
- '**.MD'
|
||||||
@@ -15,14 +15,13 @@ on:
|
|||||||
- 'LICENSE'
|
- 'LICENSE'
|
||||||
- '.gitattributes'
|
- '.gitattributes'
|
||||||
- '.gitignore'
|
- '.gitignore'
|
||||||
|
- 'requirements-docker.txt'
|
||||||
|
- 'Dockerfile-base'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build_and_publish_base_image:
|
build_and_publish_image:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v5
|
|
||||||
|
|
||||||
- name: Login to GitHub Container Registry
|
- name: Login to GitHub Container Registry
|
||||||
uses: docker/login-action@v3
|
uses: docker/login-action@v3
|
||||||
with:
|
with:
|
||||||
@@ -36,32 +35,17 @@ jobs:
|
|||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v3
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
- name: Set Release Date
|
|
||||||
id: release_date
|
|
||||||
run: |
|
|
||||||
echo "release_date=$(date --rfc-3339=date)" >> $GITHUB_OUTPUT
|
|
||||||
|
|
||||||
- name: Docker meta
|
- name: Docker meta
|
||||||
id: meta
|
id: meta
|
||||||
uses: docker/metadata-action@v5
|
uses: docker/metadata-action@v5
|
||||||
with:
|
with:
|
||||||
images: ghcr.io/${{ github.repository_owner }}/kcc
|
images: ghcr.io/${{ github.repository_owner }}/kcc
|
||||||
# Always creates the "latest" tag
|
|
||||||
flavor: |
|
|
||||||
latest=true
|
|
||||||
tags: |
|
|
||||||
type=ref,event=tag
|
|
||||||
type=raw,value=${{ steps.release_date.outputs.release_date }}
|
|
||||||
|
|
||||||
- name: Build and push
|
- name: Build and push
|
||||||
uses: docker/build-push-action@v6
|
uses: docker/build-push-action@v6
|
||||||
with:
|
with:
|
||||||
platforms: linux/amd64,linux/arm64,linux/arm/v7
|
platforms: linux/amd64,linux/arm64,linux/arm/v7
|
||||||
context: .
|
|
||||||
push: true
|
push: true
|
||||||
tags: |
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
${{ steps.meta.outputs.tags }}
|
cache-from: type=registry,ref=ghcr.io/${{ github.repository_owner }}/kcc:final-cache
|
||||||
cache-from: |
|
cache-to: type=registry,ref=ghcr.io/${{ github.repository_owner }}/kcc:final-cache,mode=max
|
||||||
type=registry,ref=ghcr.io/ciromattia/kcc:cache
|
|
||||||
type=registry,ref=ghcr.io/${{ github.repository_owner }}/kcc:cache
|
|
||||||
cache-to: type=registry,ref=ghcr.io/${{ github.repository_owner }}/kcc:cache,mode=max
|
|
||||||
|
|||||||
61
Dockerfile
61
Dockerfile
@@ -1,77 +1,20 @@
|
|||||||
# STAGE 1: BUILDER
|
FROM ghcr.io/ciromattia/kcc:base-latest
|
||||||
# Contains all build tools and dev dependencies, will be discarded
|
|
||||||
FROM python:3.13-slim-bullseye AS builder
|
|
||||||
|
|
||||||
# Install system dependencies
|
|
||||||
RUN set -x && \
|
|
||||||
BUILD_DEPS="build-essential cmake libffi-dev libfreetype6-dev libfontconfig1-dev libpng-dev libjpeg-dev libssl-dev libxft-dev make python3-dev python3-setuptools python3-wheel" && \
|
|
||||||
RUNTIME_DEPS="bash ca-certificates chrpath locales locales-all libfreetype6 libfontconfig1 p7zip-full python3 python3-pip libgl1" && \
|
|
||||||
DEBIAN_FRONTEND=noninteractive apt-get update -y && \
|
|
||||||
apt-get install -y --no-install-recommends ${BUILD_DEPS} ${RUNTIME_DEPS}
|
|
||||||
|
|
||||||
RUN \
|
|
||||||
set -x && \
|
|
||||||
python -m venv /opt/venv && \
|
|
||||||
. /opt/venv/bin/activate && \
|
|
||||||
pip install --upgrade pip
|
|
||||||
|
|
||||||
# Install numpy first, as it is unlikely to change and takes too long to compile
|
|
||||||
RUN \
|
|
||||||
set -x && \
|
|
||||||
. /opt/venv/bin/activate && \
|
|
||||||
pip install --no-cache-dir numpy==2.3.4
|
|
||||||
|
|
||||||
# Install PyMuPDF separately, as it is likely to change but still takes too long to compile
|
|
||||||
RUN \
|
|
||||||
set -x && \
|
|
||||||
. /opt/venv/bin/activate && \
|
|
||||||
pip install --no-cache-dir PyMuPDF==1.26.6
|
|
||||||
|
|
||||||
# Install Python dependencies using virtual environment
|
|
||||||
COPY requirements-docker.txt .
|
|
||||||
|
|
||||||
RUN \
|
|
||||||
set -x && \
|
|
||||||
. /opt/venv/bin/activate && \
|
|
||||||
pip install --no-cache-dir -r requirements-docker.txt
|
|
||||||
|
|
||||||
# STAGE 2: FINAL
|
|
||||||
# Clean, small and secure image with only runtime dependencies
|
|
||||||
FROM python:3.13-slim-bullseye
|
|
||||||
|
|
||||||
# Install runtime dependencies only
|
|
||||||
RUN \
|
|
||||||
set -x && \
|
|
||||||
DEBIAN_FRONTEND=noninteractive apt-get update -y && \
|
|
||||||
apt-get install -y --no-install-recommends p7zip-full && \
|
|
||||||
rm -rf /var/lib/apt/lists/*
|
|
||||||
|
|
||||||
# Copy artifacts from builder
|
|
||||||
COPY --from=builder /opt/venv /opt/venv
|
|
||||||
COPY . /opt/kcc/
|
COPY . /opt/kcc/
|
||||||
|
|
||||||
WORKDIR /opt/kcc
|
|
||||||
ENV PATH="/opt/venv/bin:$PATH"
|
|
||||||
|
|
||||||
# Setup executable and version file
|
# Setup executable and version file
|
||||||
RUN \
|
RUN \
|
||||||
chmod +x /opt/kcc/entrypoint.sh && \
|
chmod +x /opt/kcc/entrypoint.sh && \
|
||||||
ln -s /opt/kcc/kcc-c2e.py /usr/local/bin/c2e && \
|
ln -s /opt/kcc/kcc-c2e.py /usr/local/bin/c2e && \
|
||||||
ln -s /opt/kcc/kcc-c2p.py /usr/local/bin/c2p && \
|
ln -s /opt/kcc/kcc-c2p.py /usr/local/bin/c2p && \
|
||||||
ln -s /opt/kcc/entrypoint.sh /usr/local/bin/entrypoint && \
|
ln -s /opt/kcc/entrypoint.sh /usr/local/bin/entrypoint && \
|
||||||
ln -s /opt/kcc/kindlegen/kindlegen /usr/local/bin/kindlegen && \
|
|
||||||
cat /opt/kcc/kindlecomicconverter/__init__.py | grep version | awk '{print $3}' | sed "s/'//g" > /IMAGE_VERSION
|
cat /opt/kcc/kindlecomicconverter/__init__.py | grep version | awk '{print $3}' | sed "s/'//g" > /IMAGE_VERSION
|
||||||
|
|
||||||
LABEL com.kcc.name="Kindle Comic Converter" \
|
LABEL com.kcc.name="Kindle Comic Converter" \
|
||||||
com.kcc.author="Ciro Mattia Gonano, Paweł Jastrzębski and Darodi" \
|
com.kcc.author="Ciro Mattia Gonano, Paweł Jastrzębski and Darodi" \
|
||||||
org.opencontainers.image.title="Kindle Comic Converter" \
|
|
||||||
org.opencontainers.image.description='Kindle Comic Converter' \
|
org.opencontainers.image.description='Kindle Comic Converter' \
|
||||||
org.opencontainers.image.documentation='https://github.com/ciromattia/kcc' \
|
|
||||||
org.opencontainers.image.source='https://github.com/ciromattia/kcc' \
|
org.opencontainers.image.source='https://github.com/ciromattia/kcc' \
|
||||||
org.opencontainers.image.authors='Darodi and José Cerezo' \
|
org.opencontainers.image.title="Kindle Comic Converter"
|
||||||
org.opencontainers.image.url='https://github.com/ciromattia/kcc' \
|
|
||||||
org.opencontainers.image.vendor='ciromattia' \
|
|
||||||
org.opencontainers.image.licenses='ISC'
|
|
||||||
|
|
||||||
ENTRYPOINT ["entrypoint"]
|
ENTRYPOINT ["entrypoint"]
|
||||||
CMD ["-h"]
|
CMD ["-h"]
|
||||||
44
Dockerfile-base
Normal file
44
Dockerfile-base
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
# STAGE 1: BUILDER
|
||||||
|
# Contains all build tools and dev dependencies, will be discarded
|
||||||
|
FROM python:3.13-slim-bullseye AS builder
|
||||||
|
|
||||||
|
ARG TARGETARCH
|
||||||
|
|
||||||
|
# Install system dependencies
|
||||||
|
RUN set -x && \
|
||||||
|
BUILD_DEPS="build-essential cmake libffi-dev libfreetype6-dev libfontconfig1-dev libpng-dev libjpeg-dev libssl-dev libxft-dev make python3-dev python3-setuptools python3-wheel" && \
|
||||||
|
RUNTIME_DEPS="bash ca-certificates chrpath locales locales-all libfreetype6 libfontconfig1 p7zip-full python3 python3-pip unrar-free libgl1" && \
|
||||||
|
DEBIAN_FRONTEND=noninteractive apt-get update -y && \
|
||||||
|
apt-get install -y --no-install-recommends ${BUILD_DEPS} ${RUNTIME_DEPS}
|
||||||
|
|
||||||
|
# Install Python dependencies using virtual environment
|
||||||
|
COPY requirements-docker.txt .
|
||||||
|
RUN \
|
||||||
|
set -x && \
|
||||||
|
python -m venv /opt/venv && \
|
||||||
|
. /opt/venv/bin/activate && \
|
||||||
|
pip install --upgrade pip && \
|
||||||
|
pip install --no-cache-dir -r requirements-docker.txt
|
||||||
|
|
||||||
|
# STAGE 2: FINAL
|
||||||
|
# Clean, small and secure image with only runtime dependencies
|
||||||
|
FROM python:3.13-slim-bullseye
|
||||||
|
|
||||||
|
# Install runtime dependencies only
|
||||||
|
RUN \
|
||||||
|
set -x && \
|
||||||
|
DEBIAN_FRONTEND=noninteractive apt-get update -y && \
|
||||||
|
apt-get install -y --no-install-recommends p7zip-full unrar-free && \
|
||||||
|
rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
# Copy artifacts from builder
|
||||||
|
COPY --from=builder /opt/venv /opt/venv
|
||||||
|
|
||||||
|
WORKDIR /opt/kcc
|
||||||
|
ENV PATH="/opt/venv/bin:$PATH"
|
||||||
|
|
||||||
|
LABEL com.kcc.name="Kindle Comic Converter" \
|
||||||
|
com.kcc.author="Ciro Mattia Gonano, Paweł Jastrzębski and Darodi" \
|
||||||
|
org.opencontainers.image.description='Kindle Comic Converter Base Image' \
|
||||||
|
org.opencontainers.image.source='https://github.com/ciromattia/kcc' \
|
||||||
|
org.opencontainers.image.title="Kindle Comic Converter Base Image"
|
||||||
@@ -26,7 +26,7 @@ which have different requirements than normal LCD screens.
|
|||||||
Combining that with downscaling to your specific device's screen resolution
|
Combining that with downscaling to your specific device's screen resolution
|
||||||
can result in filesize reductions of hundreds of MB per volume with no visible quality loss on eink.
|
can result in filesize reductions of hundreds of MB per volume with no visible quality loss on eink.
|
||||||
This can also improve battery life, page turn speed, and general performance
|
This can also improve battery life, page turn speed, and general performance
|
||||||
on underpowered ereaders with small memory and storage capacities.
|
on underpowered ereaders with small storage capacities.
|
||||||
|
|
||||||
KCC avoids many common formatting issues (some of which occur [even on the Kindle Store](https://github.com/ciromattia/kcc/wiki/Kindle-Store-bad-formatting)), such as:
|
KCC avoids many common formatting issues (some of which occur [even on the Kindle Store](https://github.com/ciromattia/kcc/wiki/Kindle-Store-bad-formatting)), such as:
|
||||||
1) faded black levels causing unneccessarily low contrast, which is hard to see and can cause eyestrain.
|
1) faded black levels causing unneccessarily low contrast, which is hard to see and can cause eyestrain.
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
__version__ = '9.3.1'
|
__version__ = '9.3.0'
|
||||||
__license__ = 'ISC'
|
__license__ = 'ISC'
|
||||||
__copyright__ = '2012-2022, Ciro Mattia Gonano <ciromattia@gmail.com>, Pawel Jastrzebski <pawelj@iosphe.re>, darodi'
|
__copyright__ = '2012-2022, Ciro Mattia Gonano <ciromattia@gmail.com>, Pawel Jastrzebski <pawelj@iosphe.re>, darodi'
|
||||||
__docformat__ = 'restructuredtext en'
|
__docformat__ = 'restructuredtext en'
|
||||||
|
|||||||
@@ -6,6 +6,5 @@ packaging>=23.2
|
|||||||
mozjpeg-lossless-optimization>=1.2.0
|
mozjpeg-lossless-optimization>=1.2.0
|
||||||
natsort>=8.4.0
|
natsort>=8.4.0
|
||||||
distro>=1.8.0
|
distro>=1.8.0
|
||||||
# Below requirements are compiled in Dockefile
|
numpy>=1.22.4
|
||||||
# numpy==2.3.4
|
PyMuPDF>=1.18.0
|
||||||
# PyMuPDF==1.26.6
|
|
||||||
|
|||||||
Reference in New Issue
Block a user