diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..501d03f --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +patches/calibre-web/optional-requirements.txt +patches/calibre-web/optional-requirements.txt.sav +build.log diff --git a/Dockerfile b/Dockerfile index 1ace51c..9012c28 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM debian:trixie-slim AS build +FROM ubuntu:noble AS build # set version label ARG BUILD_DATE @@ -7,54 +7,69 @@ ARG CALIBREWEB_RELEASE ARG CALIBRE_INSTALLER_SOURCE_CODE_URL=https://raw.githubusercontent.com/kovidgoyal/calibre/master/setup/linux-installer.py ARG NETIFACES_PLUS_RELEASE ARG KEPUBIFY_RELEASE +# Configurer debconf pour utiliser un frontend non interactif +ARG DEBIAN_FRONTEND=noninteractive +ARG DEBCONF_NONINTERACTIVE_SEEN=true + LABEL build_version="petite-maison-orange.fr version:- ${VERSION} Build-date:- ${BUILD_DATE}" LABEL maintainer="Eric Coissac " -RUN cp /etc/apt/sources.list.d/debian.sources \ - /etc/apt/sources.list.d/debian.sources.save \ - && sed -e "s/contrib main/contrib main non-free-firmware/g" \ - /etc/apt/sources.list.d/debian.sources.save > /etc/apt/sources.list.d/debian.sources +# RUN cp /etc/apt/sources.list.d/debian.sources \ +# /etc/apt/sources.list.d/debian.sources.save \ +# && sed -e "s/contrib main/contrib main non-free-firmware/g" \ +# /etc/apt/sources.list.d/debian.sources.save > /etc/apt/sources.list.d/debian.sources RUN \ - echo "**** install build packages ****" 1>&2 \ + echo "**** Installing required packages ****" 1>&2 \ && apt-get update \ - && apt-get install -y libxcb-xkb-dev \ - && apt-get install -y build-essential \ - && apt-get install -y tzdata \ - && apt-get install -y libzmq3-dev \ - && apt-get install -y libldap-dev \ - && apt-get install -y libsasl2-dev \ - && apt-get install -y libxml2-dev \ - && apt-get install -y libxslt1-dev \ - && apt-get install -y imagemagick \ - && apt-get install -y git \ - && apt-get install -y jq \ - && apt-get install -y curl \ - && apt-get install -y wget \ - && apt-get install -y xz-utils \ - && apt-get install -y bash \ - && apt-get install -y python3-pip \ - && apt-get install -y python3-venv \ - && apt-get install -y python3-dev \ - && apt-get install -y python3-setuptools \ - && apt-get install -y golang-go \ - && apt-get install -y google-mock \ - && apt-get install -y file - + && apt-get install -y --no-install-recommends \ + build-essential \ + ca-certificates \ + curl \ + file \ + git \ + golang-go \ + google-mock \ + imagemagick \ + jq \ + libegl1 \ + libgl1-mesa-glx \ + libglx-mesa0 \ + libldap2-dev \ + libsasl2-dev \ + libxcb-shm0 \ + libxcb-shape0 \ + libxcb-xkb-dev \ + libx11-xcb1 \ + libxkbcommon-x11-0 \ + libxml2-dev \ + libxslt1-dev \ + libzmq3-dev \ + python3-dev \ + python3-pip \ + python3-setuptools \ + python3-venv \ + tzdata \ + unrar \ + wget \ + xz-utils \ + bash RUN echo "**** create tmp dir ****" 1>&2 \ && mkdir -p /tmp - RUN \ - echo "**** install Unrar from source" 1>&2 \ - && cd /tmp \ - && curl https://www.rarlab.com/rar/unrarsrc-7.0.9.tar.gz \ - | tar zxvf - \ - && cd unrar \ - && sed 's/^DEFINES=/DEFINES=-DUSE_FALLOCATE /' \ - makefile > Makefile \ - && make -f Makefile \ - && make -f Makefile install +# Télécharger et installer Go +# Définir la version de Go à installer +ENV GO_VERSION=1.24.1 +ENV GO_TARBALL=go${GO_VERSION}.linux-amd64.tar.gz + +RUN echo "***Download and install ${GO_TARBALL}" +RUN curl -OL https://go.dev/dl/${GO_TARBALL} && \ + tar -C /usr/local -xzf ${GO_TARBALL} && \ + rm ${GO_TARBALL} + +# Définir le PATH pour Go +ENV PATH="/usr/local/go/bin:${PATH}" RUN echo "***install kepubify from source" 1>&2 \ && go install github.com/pgaskin/kepubify@latest @@ -73,7 +88,6 @@ RUN python3 -m venv /app \ && pip3 install --no-cache --upgrade tzdata \ && pip3 install --no-cache --upgrade netifaces-plus -COPY patches /tmp/patches RUN echo "**** install calibre ****" 1>&2 \ @@ -82,9 +96,10 @@ ENV LD_LIBRARY_PATH=/usr/lib:/opt/calibre/lib ENV PATH=$PATH:/opt/calibre/bin ENV LC_ALL=C ENV CALIBRE_INSTALLER=https://download.calibre-ebook.com/linux-installer.sh -RUN apt-get install -y libopengl0 \ - && apt-get install -y libegl1 \ - && apt-get install -y libxcb-cursor0 \ +RUN apt-get install -y --no-install-recommends \ + libopengl0 \ + libegl1 \ + libxcb-cursor0 \ && curl -L ${CALIBRE_INSTALLER} \ | sh /dev/stdin @@ -98,17 +113,22 @@ RUN echo "**** download calibre-web ****" 1>&2 \ && echo " ---> install version ${CALIBREWEB_RELEASE}" 1>&2 \ && git clone --depth 1 --branch ${CALIBREWEB_RELEASE} https://github.com/janeczku/calibre-web.git /app/calibreweb +COPY patches /tmp/patches RUN echo "**** apply calibre-web patches ****" 1>&2 \ && cd /app/calibreweb \ && for p in /tmp/patches/calibre-web/*.patch ; do \ - patch -p0 < ${p} \ - || cat optional-requirements.txt ; \ + echo Applying patch : $p ; \ + patch --verbose -p0 < ${p} || \ + cat optional-requirements.txt.rej; \ done RUN echo "**** build & install calibre-web ****" 1>&2 \ && . /app/bin/activate \ && cd /app/calibreweb \ && pip3 install --no-cache simpleldap \ + && cat optional-requirements.txt \ + && pip3 install --only-binary :all: greenlet \ + && pip3 install --only-binary :all: Flask-SQLAlchemy \ && pip3 install --no-cache \ -r requirements.txt \ -r optional-requirements.txt @@ -130,7 +150,7 @@ RUN yes | /app/bin/pip3 uninstall rsa ENV TZ=Europe/Paris RUN cp /usr/share/zoneinfo/$TZ /etc/localtime -FROM debian:trixie-slim AS production +FROM ubuntu:noble AS production # ports and volumes @@ -154,6 +174,11 @@ RUN apt-get install --no-install-recommends -y tzdata \ libnss3 \ libxslt1.1 \ libxml2 \ + libxkbcommon-x11-0 \ + libx11-xcb1 \ + libegl1 \ + libxcb-shm0 \ + libxcb-shape0 \ imagemagick \ bash \ procps \ diff --git a/README.md b/README.md index 101211d..aec0381 100644 --- a/README.md +++ b/README.md @@ -7,4 +7,10 @@ Build the image on macOS with orbstack docker: docker build . --platform linux/amd64 --debug ``` -docker build . --no-cache --load --platform linux/amd64 2>&1 | tee build.log \ No newline at end of file +```bash +docker build . --no-cache --load --platform linux/amd64 2>&1 | tee build.log +``` + +```bash +diff -Naur > .patch +``` \ No newline at end of file diff --git a/patches/calibre-web/optional-requirements.patch b/patches/calibre-web/optional-requirements.patch index 68c6cb9..1eeb42a 100644 --- a/patches/calibre-web/optional-requirements.patch +++ b/patches/calibre-web/optional-requirements.patch @@ -1,67 +1,44 @@ ---- optional-requirements.txt.sav 2025-03-08 10:20:58 -+++ optional-requirements.txt 2025-03-08 10:21:06 -@@ -1,5 +1,55 @@ - # GDrive Integration -+# google-api-python-client>=1.7.11,<2.200.0 -+# gevent>20.6.0,<24.3.0 -+# greenlet>=0.4.17,<3.2.0 -+# httplib2>=0.9.2,<0.23.0 -+# oauth2client>=4.0.0,<4.1.4 -+# uritemplate>=3.0.0,<4.2.0 -+# pyasn1-modules>=0.0.8,<0.5.0 -+# pyasn1>=0.1.9,<0.7.0 -+# PyDrive2>=1.3.1,<1.22.0 -+# PyYAML>=3.12,<6.1 -+# rsa>=3.4.2,<4.10.0 -+ -+# Gmail -+google-auth-oauthlib>=0.4.3,<1.3.0 - google-api-python-client>=1.7.11,<2.200.0 -+ -+# goodreads -+goodreads>=0.3.2,<0.4.0 -+python-Levenshtein>=0.12.0,<0.27.0 -+ -+# ldap login -+python-ldap>=3.0.0,<3.5.0 -+Flask-SimpleLDAP>=1.4.0,<2.1.0 -+ -+# oauth -+Flask-Dance>=2.0.0,<7.1.0 -+SQLAlchemy-Utils>=0.33.5,<0.42.0 -+ -+# metadata extraction -+rarfile>=3.2,<5.0 -+scholarly>=1.2.0,<1.8 -+markdown2>=2.0.0,<2.5.0 -+html2text>=2020.1.16,<2024.2.26 -+python-dateutil>=2.1,<2.10.0 -+beautifulsoup4>=4.0.1,<4.13.0 -+faust-cchardet>=2.1.18,<2.1.20 -+py7zr>=0.15.0,<0.21.0 -+mutagen>=1.40.0,<1.50.0 -+pycountry>=20.0.0,<25.0.0 -+ -+# Comics -+natsort>=2.2.0,<8.5.0 -+comicapi>=2.2.0,<3.3.0 -+ -+# Kobo integration -+jsonschema>=3.2.0,<4.24.0 -+ -+# QRCode for MagicLink -+qrcode>=8.0 -+# GDrive Integration -+google-api-python-client>=1.7.11,<2.200.0 - gevent>20.6.0,<24.3.0 - greenlet>=0.4.17,<3.2.0 - httplib2>=0.9.2,<0.23.0 -\ No newline at end of file -@@ -45,3 +95,6 @@ - - # Kobo integration - jsonschema>=3.2.0,<4.24.0 -+ -+# QRCode for magic link -+qrcode>=8.0 -\ No newline at end of file +*** optional-requirements.txt Sat Mar 8 10:20:58 2025 +--- optional-requirements.txt Sat Mar 8 11:00:43 2025 +*************** +*** 1,15 **** + # GDrive Integration +! google-api-python-client>=1.7.11,<2.200.0 +! gevent>20.6.0,<24.3.0 +! greenlet>=0.4.17,<3.2.0 +! httplib2>=0.9.2,<0.23.0 +! oauth2client>=4.0.0,<4.1.4 +! uritemplate>=3.0.0,<4.2.0 +! pyasn1-modules>=0.0.8,<0.5.0 +! pyasn1>=0.1.9,<0.7.0 +! PyDrive2>=1.3.1,<1.22.0 +! PyYAML>=3.12,<6.1 +! rsa>=3.4.2,<4.10.0 + + # Gmail + google-auth-oauthlib>=0.4.3,<1.3.0 +--- 1,15 ---- + # GDrive Integration +! # google-api-python-client>=1.7.11,<2.200.0 +! # gevent>20.6.0,<24.3.0 +! # greenlet>=0.4.17,<3.2.0 +! # httplib2>=0.9.2,<0.23.0 +! # oauth2client>=4.0.0,<4.1.4 +! # uritemplate>=3.0.0,<4.2.0 +! # pyasn1-modules>=0.0.8,<0.5.0 +! # pyasn1>=0.1.9,<0.7.0 +! # PyDrive2>=1.3.1,<1.22.0 +! # PyYAML>=3.12,<6.1 +! # rsa>=3.4.2,<4.10.0 + + # Gmail + google-auth-oauthlib>=0.4.3,<1.3.0 +*************** +*** 45,47 **** +--- 45,50 ---- + + # Kobo integration + jsonschema>=3.2.0,<4.24.0 ++ ++ # QRCode for MagicLink ++ qrcode>=8.0