Changes to be committed:

new file:   .gitignore
	modified:   Dockerfile
	modified:   README.md
	modified:   patches/calibre-web/optional-requirements.patch
This commit is contained in:
2025-03-09 07:43:17 +01:00
parent 7e4fe2e203
commit 98838f4db2
4 changed files with 125 additions and 114 deletions

View File

@@ -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 <eric@petite-maison-orange.fr>"
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 \