2025-03-09 07:43:17 +01:00
|
|
|
FROM ubuntu:noble AS build
|
2024-12-26 12:00:07 +01:00
|
|
|
|
|
|
|
|
# set version label
|
|
|
|
|
ARG BUILD_DATE
|
|
|
|
|
ARG VERSION
|
|
|
|
|
ARG CALIBREWEB_RELEASE
|
2024-12-26 16:07:18 +01:00
|
|
|
ARG CALIBRE_INSTALLER_SOURCE_CODE_URL=https://raw.githubusercontent.com/kovidgoyal/calibre/master/setup/linux-installer.py
|
|
|
|
|
ARG NETIFACES_PLUS_RELEASE
|
|
|
|
|
ARG KEPUBIFY_RELEASE
|
2025-03-09 07:43:17 +01:00
|
|
|
# Configurer debconf pour utiliser un frontend non interactif
|
|
|
|
|
ARG DEBIAN_FRONTEND=noninteractive
|
|
|
|
|
ARG DEBCONF_NONINTERACTIVE_SEEN=true
|
|
|
|
|
|
2024-12-26 16:07:18 +01:00
|
|
|
|
2024-12-26 12:00:07 +01:00
|
|
|
LABEL build_version="petite-maison-orange.fr version:- ${VERSION} Build-date:- ${BUILD_DATE}"
|
2024-12-26 16:07:18 +01:00
|
|
|
LABEL maintainer="Eric Coissac <eric@petite-maison-orange.fr>"
|
2024-12-26 12:00:07 +01:00
|
|
|
|
2025-03-09 07:43:17 +01:00
|
|
|
# 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
|
2024-12-26 12:00:07 +01:00
|
|
|
|
|
|
|
|
RUN \
|
2025-03-09 07:43:17 +01:00
|
|
|
echo "**** Installing required packages ****" 1>&2 \
|
2025-03-08 10:24:41 +01:00
|
|
|
&& apt-get update \
|
2025-03-09 07:43:17 +01:00
|
|
|
&& 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
|
2024-12-26 16:07:18 +01:00
|
|
|
RUN echo "**** create tmp dir ****" 1>&2 \
|
|
|
|
|
&& mkdir -p /tmp
|
|
|
|
|
|
2025-03-09 07:43:17 +01:00
|
|
|
# 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}"
|
2024-12-26 12:00:07 +01:00
|
|
|
|
2024-12-27 14:11:12 +01:00
|
|
|
RUN echo "***install kepubify from source" 1>&2 \
|
2024-12-27 16:19:12 +01:00
|
|
|
&& go install github.com/pgaskin/kepubify@latest
|
2024-12-27 14:11:12 +01:00
|
|
|
|
2024-12-26 12:00:07 +01:00
|
|
|
|
2024-12-26 16:07:18 +01:00
|
|
|
RUN echo "**** install python3 ****" 1>&2
|
2024-12-26 12:00:07 +01:00
|
|
|
ENV PYTHONUNBUFFERED=1
|
2024-12-26 16:07:18 +01:00
|
|
|
RUN python3 -m venv /app \
|
|
|
|
|
&& . /app/bin/activate \
|
2024-12-27 14:11:12 +01:00
|
|
|
&& pip3 install --no-cache --upgrade pip \
|
|
|
|
|
&& pip3 install --no-cache --upgrade setuptools \
|
|
|
|
|
&& pip3 install --no-cache --upgrade poetry \
|
2024-12-26 12:00:07 +01:00
|
|
|
&& pip3 install --no-cache cryptography \
|
|
|
|
|
&& pip3 install --no-cache ldap3 \
|
|
|
|
|
&& pip3 install --no-cache flask-ldap3-login \
|
2024-12-26 16:07:18 +01:00
|
|
|
&& pip3 install --no-cache --upgrade tzdata \
|
|
|
|
|
&& pip3 install --no-cache --upgrade netifaces-plus
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
RUN echo "**** install calibre ****" 1>&2 \
|
|
|
|
|
# install calibre binary
|
2024-12-27 14:11:12 +01:00
|
|
|
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
|
2025-03-09 07:43:17 +01:00
|
|
|
RUN apt-get install -y --no-install-recommends \
|
|
|
|
|
libopengl0 \
|
|
|
|
|
libegl1 \
|
|
|
|
|
libxcb-cursor0 \
|
2024-12-26 16:07:18 +01:00
|
|
|
&& curl -L ${CALIBRE_INSTALLER} \
|
|
|
|
|
| sh /dev/stdin
|
|
|
|
|
|
2024-12-26 12:00:07 +01:00
|
|
|
|
|
|
|
|
|
2024-12-26 16:07:18 +01:00
|
|
|
RUN echo "**** download calibre-web ****" 1>&2 \
|
|
|
|
|
&& if [ -z ${CALIBREWEB_RELEASE} ]; then \
|
2024-12-26 12:00:07 +01:00
|
|
|
CALIBREWEB_RELEASE=$(curl -sX GET "https://api.github.com/repos/janeczku/calibre-web/releases/latest" \
|
|
|
|
|
| awk '/tag_name/{print $4;exit}' FS='[""]'); \
|
|
|
|
|
fi \
|
|
|
|
|
&& echo " ---> install version ${CALIBREWEB_RELEASE}" 1>&2 \
|
2024-12-27 14:11:12 +01:00
|
|
|
&& git clone --depth 1 --branch ${CALIBREWEB_RELEASE} https://github.com/janeczku/calibre-web.git /app/calibreweb
|
2024-12-26 12:00:07 +01:00
|
|
|
|
2025-03-09 07:43:17 +01:00
|
|
|
COPY patches /tmp/patches
|
2024-12-26 12:00:07 +01:00
|
|
|
RUN echo "**** apply calibre-web patches ****" 1>&2 \
|
2024-12-27 14:11:12 +01:00
|
|
|
&& cd /app/calibreweb \
|
2025-03-08 10:24:41 +01:00
|
|
|
&& for p in /tmp/patches/calibre-web/*.patch ; do \
|
2025-03-09 07:43:17 +01:00
|
|
|
echo Applying patch : $p ; \
|
|
|
|
|
patch --verbose -p0 < ${p} || \
|
|
|
|
|
cat optional-requirements.txt.rej; \
|
2024-12-26 12:00:07 +01:00
|
|
|
done
|
|
|
|
|
|
|
|
|
|
RUN echo "**** build & install calibre-web ****" 1>&2 \
|
2024-12-26 16:07:18 +01:00
|
|
|
&& . /app/bin/activate \
|
2024-12-27 14:11:12 +01:00
|
|
|
&& cd /app/calibreweb \
|
2024-12-27 19:33:28 +01:00
|
|
|
&& pip3 install --no-cache simpleldap \
|
2025-03-09 07:43:17 +01:00
|
|
|
&& cat optional-requirements.txt \
|
|
|
|
|
&& pip3 install --only-binary :all: greenlet \
|
|
|
|
|
&& pip3 install --only-binary :all: Flask-SQLAlchemy \
|
2024-12-27 14:11:12 +01:00
|
|
|
&& pip3 install --no-cache \
|
|
|
|
|
-r requirements.txt \
|
|
|
|
|
-r optional-requirements.txt
|
|
|
|
|
|
2024-12-27 20:11:44 +01:00
|
|
|
RUN echo "**** copy unrar and kepubify to app folder ****" 1>&2 \
|
2024-12-27 16:19:12 +01:00
|
|
|
&& mv /usr/bin/unrar /app/bin \
|
|
|
|
|
&& mv ./root/go/bin/kepubify /app/bin
|
|
|
|
|
|
2024-12-26 12:00:07 +01:00
|
|
|
|
|
|
|
|
|
2024-12-27 21:17:54 +01:00
|
|
|
RUN yes | /app/bin/pip3 uninstall google-api-python-client
|
|
|
|
|
RUN yes | /app/bin/pip3 uninstall httplib2
|
|
|
|
|
RUN yes | /app/bin/pip3 uninstall oauth2client
|
|
|
|
|
RUN yes | /app/bin/pip3 uninstall uritemplate
|
|
|
|
|
RUN yes | /app/bin/pip3 uninstall PyDrive2
|
|
|
|
|
RUN yes | /app/bin/pip3 uninstall PyYAML
|
|
|
|
|
RUN yes | /app/bin/pip3 uninstall rsa
|
|
|
|
|
|
|
|
|
|
ENV TZ=Europe/Paris
|
|
|
|
|
RUN cp /usr/share/zoneinfo/$TZ /etc/localtime
|
2024-12-26 12:00:07 +01:00
|
|
|
|
2025-03-09 07:43:17 +01:00
|
|
|
FROM ubuntu:noble AS production
|
2024-12-27 16:19:12 +01:00
|
|
|
|
2024-12-27 21:17:54 +01:00
|
|
|
|
2024-12-27 17:43:55 +01:00
|
|
|
# ports and volumes
|
|
|
|
|
EXPOSE 8083
|
|
|
|
|
VOLUME /config
|
|
|
|
|
VOLUME /books
|
|
|
|
|
|
|
|
|
|
ENV PUID=1000
|
|
|
|
|
ENV PGID=1000
|
|
|
|
|
ENV TZ=Europe/Paris
|
|
|
|
|
|
|
|
|
|
|
2024-12-27 16:19:12 +01:00
|
|
|
|
2024-12-27 21:17:54 +01:00
|
|
|
RUN echo "**** install production packages ****" 1>&2
|
|
|
|
|
RUN apt-get update
|
|
|
|
|
RUN apt-get install --no-install-recommends -y tzdata \
|
|
|
|
|
libzmq5 \
|
2025-03-03 18:01:06 +01:00
|
|
|
libldap2 \
|
2024-12-27 21:17:54 +01:00
|
|
|
libsasl2-2 \
|
|
|
|
|
libnspr4 \
|
|
|
|
|
libnss3 \
|
2025-03-08 10:24:41 +01:00
|
|
|
libxslt1.1 \
|
2025-03-03 18:34:39 +01:00
|
|
|
libxml2 \
|
2025-03-09 07:43:17 +01:00
|
|
|
libxkbcommon-x11-0 \
|
|
|
|
|
libx11-xcb1 \
|
|
|
|
|
libegl1 \
|
|
|
|
|
libxcb-shm0 \
|
|
|
|
|
libxcb-shape0 \
|
2024-12-27 21:17:54 +01:00
|
|
|
imagemagick \
|
|
|
|
|
bash \
|
|
|
|
|
procps \
|
|
|
|
|
vim \
|
2025-03-08 10:24:41 +01:00
|
|
|
libxcb-xkb1 \
|
2024-12-27 21:17:54 +01:00
|
|
|
python3
|
2024-12-27 16:19:12 +01:00
|
|
|
|
|
|
|
|
COPY --from=build /app /app
|
2024-12-27 17:08:01 +01:00
|
|
|
COPY --from=build /opt/calibre/bin /app/bin
|
|
|
|
|
COPY --from=build /opt/calibre/lib/libcalibre-launcher.so /usr/lib/libcalibre-launcher.so
|
|
|
|
|
COPY --from=build /opt/calibre/lib/libjpeg.so.8 /usr/lib/libjpeg.so.8
|
|
|
|
|
COPY --from=build /opt/calibre/lib/libpython3.11.so.1.0 /usr/lib/libpython3.11.so.1.0
|
|
|
|
|
COPY --from=build /opt/calibre/lib/libpoppler.so.130 /usr/lib/libpoppler.so.130
|
2024-12-27 16:19:12 +01:00
|
|
|
|
2024-12-27 17:43:55 +01:00
|
|
|
RUN apt-get clean
|
|
|
|
|
RUN rm -rf /var/lib/apt/lists/* \
|
|
|
|
|
/tmp/* \
|
|
|
|
|
/var/tmp/* \
|
|
|
|
|
/usr/share/doc/*
|
|
|
|
|
|
2024-12-27 21:17:54 +01:00
|
|
|
RUN echo "**** Setting timezone ****" 2>&1 \
|
|
|
|
|
&& echo $TZ > /etc/timezone
|
|
|
|
|
COPY --from=build /etc/timezone /etc/timezone
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
RUN mkdir -p /config \
|
|
|
|
|
&& chown -R ${PUID}:${PGID} /config
|
|
|
|
|
|
2025-03-03 17:55:30 +01:00
|
|
|
WORKDIR /usr/bin
|
|
|
|
|
RUN ln -s /apt/bin/calibredb /usr/bin/calibredb
|
|
|
|
|
RUN ln -s /apt/bin/calibre /usr/bin/calibre
|
2024-12-27 17:43:55 +01:00
|
|
|
|
|
|
|
|
WORKDIR /app
|
2024-12-26 12:00:07 +01:00
|
|
|
USER ${PUID}:${PGID}
|
|
|
|
|
|
2024-12-27 20:18:12 +01:00
|
|
|
CMD ["/app/bin/python3", "/app/calibreweb/cps.py", "-p", "/config/app.db", "-g", "/config/gdrive.db", "-o", "/config/calibre-web.log"]
|