From bce587c6774a2a0dc5c97d67ee0d038f2a4c9789 Mon Sep 17 00:00:00 2001 From: Eric Coissac Date: Thu, 26 Dec 2024 12:00:07 +0100 Subject: [PATCH] Ajouter Dockerfile --- Dockerfile | 113 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 113 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..d054dd1 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,113 @@ +# syntax=docker/dockerfile:1 + +FROM alpine:3.20 + +# set version label +ARG BUILD_DATE +ARG VERSION +ARG CALIBREWEB_RELEASE +LABEL build_version="petite-maison-orange.fr version:- ${VERSION} Build-date:- ${BUILD_DATE}" +LABEL maintainer="eric@petite-maison-orange.fr" + +RUN \ + echo "**** install build packages ****" 1>&2 \ + && apk add build-base \ + && apk add --update --no-cache linux-headers \ + && apk add --update --no-cache calibre \ + --repository=http://dl-cdn.alpinelinux.org/alpine/edge/testing/ \ + && apk add --update --no-cache tzdata \ + && apk add --update --no-cache zeromq-dev \ + && apk add --update --no-cache libldap \ + && apk add --update --no-cache openldap-dev \ + && apk add --update --no-cache libsasl \ + && apk add --update --no-cache imagemagick \ + && apk add --update --no-cache git \ + && apk add --update --no-cache curl + +RUN \ + echo "**** install Unrar from source" 1>&2 \ + && 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 \ + && cd .. + + +RUN echo "**** install python3" 1>&2 +ENV PYTHONUNBUFFERED=1 +RUN apk add --update --no-cache python3 \ + && apk add --update --no-cache python3-dev \ + && ln -sf /usr/bin/python3 /usr/bin/python \ + && apk add --update --no-cache py3-pip \ + && apk add --update --no-cache py3-virtualenv \ + && python -m venv /app \ + && source /app/bin/activate \ + && pip3 install --no-cache cryptography \ + && pip3 install --no-cache ldap3 \ + && pip3 install --no-cache flask-ldap3-login \ + && pip3 install --no-cache --upgrade pip setuptools \ + && pip3 install --no-cache netifaces-plus \ + && pip3 install --no-cache --upgrade tzdata + + +RUN echo "**** download calibre-web" 1>&2 \ + && if [ -z ${CALIBREWEB_RELEASE+x} ]; then \ + 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 \ + && https://api.github.com/repos/janeczku/calibre-web/releases/latest + && git clone --depth 1 --branch ${CALIBREWEB_RELEASE} https://github.com/janeczku/calibre-web.git /calibreweb \ + && mkdir -p calibreweb/src \ + && ln -s /calibreweb /calibreweb/src/calibreweb + +COPY patches calibreweb/src + +RUN echo "**** apply calibre-web patches ****" 1>&2 \ + && cd calibreweb/src/calibreweb \ + && for p in ../patches/* ; do \ + patch -p1 < ${p} ; \ + done + +RUN echo "**** build & install calibre-web ****" 1>&2 \ + && source /app/bin/activate \ + && cd calibreweb \ + && pip3 install -U --no-cache-dir \ + -r requirements.txt \ + -r optional-requirements.txt \ + && cd .. \ + && pip3 install /calibreweb + + RUN echo "***install kepubify" 1>&2 && \ + if [ -z ${KEPUBIFY_RELEASE+x} ]; then \ + KEPUBIFY_RELEASE=$(curl -sX GET "https://api.github.com/repos/pgaskin/kepubify/releases/latest" \ + | awk '/tag_name/{print $4;exit}' FS='[""]'); \ + fi \ + && curl -o \ + /usr/bin/kepubify -L \ + https://github.com/pgaskin/kepubify/releases/download/${KEPUBIFY_RELEASE}/kepubify-linux-64bit \ + && chmod +x /usr/bin/kepubify + +# ports and volumes +EXPOSE 8083 +VOLUME /config +VOLUME /books + +ENV PUID=1000 +ENV PGID=1000 +ENV TZ=Europe/Paris + +RUN \ +echo "**** Setting timezone ****" \ +&& ln -snf /usr/share/zoneinfo/$TZ /etc/localtime \ +&& echo $TZ > /etc/timezone + +RUN if [[ ! -f /config ]] ; then mkdir -p /config ; fi +RUN chown -R ${PUID}:${PGID} /config + +USER ${PUID}:${PGID} + +CMD /app/bin/python3 /app/lib/python3.12/site-packages/calibreweb/cps.py -p /config/app.db -g /config/gdrive.db -o /config/calibre-web.log \ No newline at end of file