diff --git a/Dockerfile b/Dockerfile index 63c4e41f..bae7ed6c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,60 +1,32 @@ -FROM lsiobase/python:3.9 +FROM lsiobase/ubuntu:bionic # set version label ARG BUILD_DATE ARG VERSION -ARG CALIBRE_COMMIT +ARG CALIBREWEB_RELEASE LABEL build_version="Linuxserver.io version:- ${VERSION} Build-date:- ${BUILD_DATE}" LABEL maintainer="chbmb" RUN \ echo "**** install build packages ****" && \ - apk add --no-cache --virtual=build-dependencies \ - file \ - fontconfig-dev \ - freetype-dev \ - g++ \ - gcc \ - ghostscript-dev \ - lcms2-dev \ - libjpeg-turbo-dev \ - libpng-dev \ - libtool \ - libwebp-dev \ - libxml2-dev \ - libxslt-dev \ - make \ - perl-dev \ - python2-dev \ - tiff-dev \ - xz \ - zlib-dev && \ + apt-get update && \ + apt-get install -y \ + git \ + python-pip && \ echo "**** install runtime packages ****" && \ - apk add --no-cache \ - fontconfig \ - freetype \ - ghostscript \ - imagemagick6 \ - jq \ - lcms2 \ - libjpeg-turbo \ - libltdl \ - libpng \ - libwebp \ - libxml2 \ - libxslt \ - tiff \ - zlib && \ + apt-get install -y \ + imagemagick \ + python-minimal && \ echo "**** install calibre-web ****" && \ - if [ -z ${CALIBRE_COMMIT+x} ]; then \ - CALIBRE_COMMIT=$(curl -sX GET https://api.github.com/repos/janeczku/calibre-web/commits/master \ - | jq -r '. | .sha'); \ + 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 && \ - mkdir -p \ - /app/calibre-web && \ curl -o \ /tmp/calibre-web.tar.gz -L \ - https://github.com/janeczku/calibre-web/archive/${CALIBRE_COMMIT}.tar.gz && \ + https://github.com/janeczku/calibre-web/archive/${CALIBREWEB_RELEASE}.tar.gz && \ + mkdir -p \ + /app/calibre-web && \ tar xf \ /tmp/calibre-web.tar.gz -C \ /app/calibre-web --strip-components=1 && \ @@ -64,11 +36,15 @@ RUN \ pip install --no-cache-dir -U -r \ optional-requirements.txt && \ echo "**** cleanup ****" && \ - apk del --purge \ - build-dependencies && \ + apt-get -y purge \ + git \ + python-pip && \ + apt-get -y autoremove && \ rm -rf \ - /tmp/* - + /tmp/* \ + /var/lib/apt/lists/* \ + /var/tmp/* + # add local files COPY root/ / diff --git a/Dockerfile.aarch64 b/Dockerfile.aarch64 index e30448fa..2eae7bb2 100644 --- a/Dockerfile.aarch64 +++ b/Dockerfile.aarch64 @@ -1,60 +1,39 @@ -FROM lsiobase/python:arm64v8-3.9 +FROM lsiobase/ubuntu:arm64v8-bionic # set version label ARG BUILD_DATE ARG VERSION -ARG CALIBRE_COMMIT +ARG CALIBREWEB_RELEASE LABEL build_version="Linuxserver.io version:- ${VERSION} Build-date:- ${BUILD_DATE}" LABEL maintainer="chbmb" RUN \ echo "**** install build packages ****" && \ - apk add --no-cache --virtual=build-dependencies \ - file \ - fontconfig-dev \ - freetype-dev \ + apt-get update && \ + apt-get install -y \ g++ \ gcc \ - ghostscript-dev \ - lcms2-dev \ - libjpeg-turbo-dev \ - libpng-dev \ - libtool \ - libwebp-dev \ + git \ + libffi-dev \ + libjpeg-dev \ libxml2-dev \ - libxslt-dev \ - make \ - perl-dev \ - python2-dev \ - tiff-dev \ - xz \ - zlib-dev && \ + libxslt1-dev \ + python-pip \ + zlib1g-dev && \ echo "**** install runtime packages ****" && \ - apk add --no-cache \ - fontconfig \ - freetype \ - ghostscript \ - imagemagick6 \ - jq \ - lcms2 \ - libjpeg-turbo \ - libltdl \ - libpng \ - libwebp \ - libxml2 \ - libxslt \ - tiff \ - zlib && \ + apt-get install -y \ + imagemagick \ + python-minimal && \ echo "**** install calibre-web ****" && \ - if [ -z ${CALIBRE_COMMIT+x} ]; then \ - CALIBRE_COMMIT=$(curl -sX GET https://api.github.com/repos/janeczku/calibre-web/commits/master \ - | jq -r '. | .sha'); \ + 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 && \ - mkdir -p \ - /app/calibre-web && \ curl -o \ /tmp/calibre-web.tar.gz -L \ - https://github.com/janeczku/calibre-web/archive/${CALIBRE_COMMIT}.tar.gz && \ + https://github.com/janeczku/calibre-web/archive/${CALIBREWEB_RELEASE}.tar.gz && \ + mkdir -p \ + /app/calibre-web && \ tar xf \ /tmp/calibre-web.tar.gz -C \ /app/calibre-web --strip-components=1 && \ @@ -64,10 +43,21 @@ RUN \ pip install --no-cache-dir -U -r \ optional-requirements.txt && \ echo "**** cleanup ****" && \ - apk del --purge \ - build-dependencies && \ + apt-get -y purge \ + g++ \ + gcc \ + git \ + libffi-dev \ + libjpeg-dev \ + libxml2-dev \ + libxslt1-dev \ + python-pip \ + zlib1g-dev && \ + apt-get -y autoremove && \ rm -rf \ - /tmp/* + /tmp/* \ + /var/lib/apt/lists/* \ + /var/tmp/* # add local files COPY root/ / diff --git a/Dockerfile.armhf b/Dockerfile.armhf index d5e67640..3bef0815 100644 --- a/Dockerfile.armhf +++ b/Dockerfile.armhf @@ -1,60 +1,39 @@ -FROM lsiobase/python:arm32v7-3.9 +FROM lsiobase/ubuntu:arm32v7-bionic # set version label ARG BUILD_DATE ARG VERSION -ARG CALIBRE_COMMIT +ARG CALIBREWEB_RELEASE LABEL build_version="Linuxserver.io version:- ${VERSION} Build-date:- ${BUILD_DATE}" LABEL maintainer="chbmb" RUN \ echo "**** install build packages ****" && \ - apk add --no-cache --virtual=build-dependencies \ - file \ - fontconfig-dev \ - freetype-dev \ + apt-get update && \ + apt-get install -y \ g++ \ gcc \ - ghostscript-dev \ - lcms2-dev \ - libjpeg-turbo-dev \ - libpng-dev \ - libtool \ - libwebp-dev \ + git \ + libffi-dev \ + libjpeg-dev \ libxml2-dev \ - libxslt-dev \ - make \ - perl-dev \ - python2-dev \ - tiff-dev \ - xz \ - zlib-dev && \ + libxslt1-dev \ + python-pip \ + zlib1g-dev && \ echo "**** install runtime packages ****" && \ - apk add --no-cache \ - fontconfig \ - freetype \ - ghostscript \ - imagemagick6 \ - jq \ - lcms2 \ - libjpeg-turbo \ - libltdl \ - libpng \ - libwebp \ - libxml2 \ - libxslt \ - tiff \ - zlib && \ + apt-get install -y \ + imagemagick \ + python-minimal && \ echo "**** install calibre-web ****" && \ - if [ -z ${CALIBRE_COMMIT+x} ]; then \ - CALIBRE_COMMIT=$(curl -sX GET https://api.github.com/repos/janeczku/calibre-web/commits/master \ - | jq -r '. | .sha'); \ + 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 && \ - mkdir -p \ - /app/calibre-web && \ curl -o \ /tmp/calibre-web.tar.gz -L \ - https://github.com/janeczku/calibre-web/archive/${CALIBRE_COMMIT}.tar.gz && \ + https://github.com/janeczku/calibre-web/archive/${CALIBREWEB_RELEASE}.tar.gz && \ + mkdir -p \ + /app/calibre-web && \ tar xf \ /tmp/calibre-web.tar.gz -C \ /app/calibre-web --strip-components=1 && \ @@ -64,10 +43,21 @@ RUN \ pip install --no-cache-dir -U -r \ optional-requirements.txt && \ echo "**** cleanup ****" && \ - apk del --purge \ - build-dependencies && \ + apt-get -y purge \ + g++ \ + gcc \ + git \ + libffi-dev \ + libjpeg-dev \ + libxml2-dev \ + libxslt1-dev \ + python-pip \ + zlib1g-dev && \ + apt-get -y autoremove && \ rm -rf \ - /tmp/* + /tmp/* \ + /var/lib/apt/lists/* \ + /var/tmp/* # add local files COPY root/ / diff --git a/Jenkinsfile b/Jenkinsfile index 38fd7545..0dacc241 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -13,14 +13,14 @@ pipeline { EXT_GIT_BRANCH = 'master' EXT_USER = 'janeczku' EXT_REPO = 'calibre-web' - BUILD_VERSION_ARG = 'CALIBRE_COMMIT' + BUILD_VERSION_ARG = 'CALIBREWEB_RELEASE' LS_USER = 'linuxserver' LS_REPO = 'docker-calibre-web' CONTAINER_NAME = 'calibre-web' DOCKERHUB_IMAGE = 'linuxserver/calibre-web' DEV_DOCKERHUB_IMAGE = 'lsiodev/calibre-web' PR_DOCKERHUB_IMAGE = 'lspipepr/calibre-web' - DIST_IMAGE = 'alpine' + DIST_IMAGE = 'ubuntu' MULTIARCH='true' CI='true' CI_WEB='true' @@ -102,21 +102,21 @@ pipeline { /* ######################## External Release Tagging ######################## */ - // If this is a github commit trigger determine the current commit at head - stage("Set ENV github_commit"){ + // If this is a stable github release use the latest endpoint from github to determine the ext tag + stage("Set ENV github_stable"){ steps{ script{ env.EXT_RELEASE = sh( - script: '''curl -s https://api.github.com/repos/${EXT_USER}/${EXT_REPO}/commits/${EXT_GIT_BRANCH} | jq -r '. | .sha' | cut -c1-8 ''', + script: '''curl -s https://api.github.com/repos/${EXT_USER}/${EXT_REPO}/releases/latest | jq -r '. | .tag_name' ''', returnStdout: true).trim() } } } - // If this is a github commit trigger Set the external release link - stage("Set ENV commit_link"){ + // If this is a stable or devel github release generate the link for the build message + stage("Set ENV github_link"){ steps{ script{ - env.RELEASE_LINK = 'https://github.com/' + env.EXT_USER + '/' + env.EXT_REPO + '/commit/' + env.EXT_RELEASE + env.RELEASE_LINK = 'https://github.com/' + env.EXT_USER + '/' + env.EXT_REPO + '/releases/tag/' + env.EXT_RELEASE } } } @@ -605,7 +605,7 @@ pipeline { "tagger": {"name": "LinuxServer Jenkins","email": "jenkins@linuxserver.io","date": "'${GITHUB_DATE}'"}}' ''' echo "Pushing New release for Tag" sh '''#! /bin/bash - curl -s https://api.github.com/repos/${EXT_USER}/${EXT_REPO}/commits/${EXT_GIT_BRANCH} | jq '. | .commit.message' | sed 's:^.\\(.*\\).$:\\1:' > releasebody.json + curl -s https://api.github.com/repos/${EXT_USER}/${EXT_REPO}/releases/latest | jq '. |.body' | sed 's:^.\\(.*\\).$:\\1:' > releasebody.json echo '{"tag_name":"'${EXT_RELEASE_CLEAN}'-ls'${LS_TAG_NUMBER}'",\ "target_commitish": "master",\ "name": "'${EXT_RELEASE_CLEAN}'-ls'${LS_TAG_NUMBER}'",\ diff --git a/README.md b/README.md index c9f05173..eadf91f4 100644 --- a/README.md +++ b/README.md @@ -199,6 +199,7 @@ Once registered you can define the dockerfile to use with `-f Dockerfile.aarch64 ## Versions +* **02.06.19:** - Rebase to Ubuntu Bionic & add Gdrive support. * **23.03.19:** - Switching to new Base images, shift to arm32v7 tag. * **23.02.19:** - Rebase to alpine 3.9, use repo version of imagemagick. * **11.02.19:** - Add pipeline logic and multi arch. diff --git a/jenkins-vars.yml b/jenkins-vars.yml index 5271e2c9..f31a209a 100644 --- a/jenkins-vars.yml +++ b/jenkins-vars.yml @@ -2,7 +2,7 @@ # jenkins variables project_name: docker-calibre-web -external_type: github_commit +external_type: github_stable release_type: stable release_tag: latest ls_branch: master @@ -10,14 +10,14 @@ repo_vars: - EXT_GIT_BRANCH = 'master' - EXT_USER = 'janeczku' - EXT_REPO = 'calibre-web' - - BUILD_VERSION_ARG = 'CALIBRE_COMMIT' + - BUILD_VERSION_ARG = 'CALIBREWEB_RELEASE' - LS_USER = 'linuxserver' - LS_REPO = 'docker-calibre-web' - CONTAINER_NAME = 'calibre-web' - DOCKERHUB_IMAGE = 'linuxserver/calibre-web' - DEV_DOCKERHUB_IMAGE = 'lsiodev/calibre-web' - PR_DOCKERHUB_IMAGE = 'lspipepr/calibre-web' - - DIST_IMAGE = 'alpine' + - DIST_IMAGE = 'ubuntu' - MULTIARCH='true' - CI='true' - CI_WEB='true' diff --git a/readme-vars.yml b/readme-vars.yml index 29895801..d7cc4bb7 100644 --- a/readme-vars.yml +++ b/readme-vars.yml @@ -9,7 +9,6 @@ project_blurb: | [{{ project_name|capitalize }}]({{ project_url }}) is a web app providing a clean interface for browsing, reading and downloading eBooks using an existing Calibre database. It is also possible to integrate google drive and edit metadata and your calibre library through the app itself. This software is a fork of library and licensed under the GPL v3 License. -project_blurb_optional_extras_enabled: false # supported architectures available_architectures: @@ -17,13 +16,9 @@ available_architectures: - { arch: "{{ arch_arm64 }}", tag: "arm64v8-latest"} - { arch: "{{ arch_armhf }}", tag: "arm32v7-latest"} -# development version -development_versions: false - # container parameters common_param_env_vars_enabled: true param_container_name: "{{ project_name }}" -param_usage_include_net: false param_usage_include_env: true param_env_vars: - { env_var: "TZ", env_value: "Europe/London", desc: "Specify a timezone to use EG Europe/London." } @@ -34,8 +29,6 @@ param_volumes: param_usage_include_ports: true param_ports: - { external_port: "8083", internal_port: "8083", port_desc: "WebUI" } -param_device_map: false -cap_add_param: false # optional container parameters opt_param_usage_include_env: false @@ -69,6 +62,7 @@ app_setup_block: | # changelog changelogs: + - { date: "02.06.19:", desc: "Rebase to Ubuntu Bionic & add Gdrive support." } - { date: "23.03.19:", desc: "Switching to new Base images, shift to arm32v7 tag." } - { date: "23.02.19:", desc: "Rebase to alpine 3.9, use repo version of imagemagick." } - { date: "11.02.19:", desc: "Add pipeline logic and multi arch." } diff --git a/root/etc/cont-init.d/30-config b/root/etc/cont-init.d/30-config index d227b8a9..17cefcb2 100644 --- a/root/etc/cont-init.d/30-config +++ b/root/etc/cont-init.d/30-config @@ -8,6 +8,7 @@ [[ ! -L /app/calibre-web/app.db ]] && \ ln -s /config/app.db /app/calibre-web/app.db +# create symlinks for log [[ ! -f /config/calibre-web.log ]] && \ touch /config/calibre-web.log [[ -f /app/calibre-web/calibre-web.log ]] && \ @@ -15,6 +16,21 @@ [[ ! -L /app/calibre-web/calibre-web.log ]] && \ ln -s /config/calibre-web.log /app/calibre-web/calibre-web.log +# create Google drive client_secrets.json file +[[ ! -f /config/client_secrets.json ]] && \ + echo "{}" > /config/client_secrets.json +[[ -f /app/calibre-web/client_secrets.json ]] && + rm /app/calibre-web/client_secrets.json +[[ ! -L /app/calibre-web/client_secrets.json ]] && + ln -s /config/client_secrets.json /app/calibre-web/client_secrets.json + +# create Google drive symlinks for database +[[ ! -f /config/gdrive.db ]] && \ + cp /app/calibre-web/gdrive.db /config/gdrive.db +[[ -f /app/calibre-web/gdrive.db ]] && \ + rm /app/calibre-web/gdrive.db +[[ ! -L /app/calibre-web/gdrive.db ]] && \ + ln -s /config/gdrive.db /app/calibre-web/gdrive.db # permissions chown -R abc:abc \