From 07c9cdb4c5e2978d0c461bc1b6eeccceab5b9653 Mon Sep 17 00:00:00 2001 From: TheSpad Date: Wed, 15 Feb 2023 15:05:00 +0000 Subject: [PATCH 1/2] Deprecate image --- Dockerfile | 76 ++-------------------------------------------- Dockerfile.aarch64 | 76 ++-------------------------------------------- Dockerfile.armhf | 76 ++-------------------------------------------- readme-vars.yml | 10 +++++- 4 files changed, 15 insertions(+), 223 deletions(-) diff --git a/Dockerfile b/Dockerfile index 725b610..4f6c0ff 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,3 +1,5 @@ +# syntax=docker/dockerfile:1 + FROM ghcr.io/linuxserver/baseimage-ubuntu:focal # set version label @@ -7,80 +9,6 @@ ARG PAPERMERGE_RELEASE LABEL build_version="Linuxserver.io version:- ${VERSION} Build-date:- ${BUILD_DATE}" LABEL maintainer="alex-phillips" -# ensures our console output looks familiar and is not buffered by Docker -ENV PYTHONUNBUFFERED 1 -ENV DJANGO_SETTINGS_MODULE config.settings.production -ARG DEBIAN_FRONTEND="noninteractive" - -# NOTE: the additional lib and python dependencies are for the ARM builds -ARG BUILD_PACKAGES="\ - apache2-dev \ - build-essential \ - git \ - libffi-dev \ - libpq-dev \ - libmariadbclient-dev \ - libxml2-dev \ - libxslt-dev \ - python3-dev \ - python3-pip" - -# packages as variables -ARG RUNTIME_PACKAGES="\ - imagemagick \ - libmariadb3 \ - libpq5 \ - libxslt1.1 \ - poppler-utils \ - python3 \ - python3-cryptography \ - python3-distutils \ - python3-mysqldb \ - python3-psycopg2 \ - python3-setuptools \ - redis \ - tesseract-ocr \ - tesseract-ocr-eng \ - uwsgi \ - uwsgi-plugin-python3" - -RUN \ - apt-get update && \ - echo "**** install build packages ****" && \ - apt-get install -y \ - --no-install-recommends \ - $BUILD_PACKAGES && \ - echo "**** install runtime packages ****" && \ - apt-get install -y \ - --no-install-recommends \ - $RUNTIME_PACKAGES && \ - echo "**** install papermerge ****" && \ - mkdir -p /app/papermerge && \ - if [ -z ${PAPERMERGE_RELEASE+x} ]; then \ - PAPERMERGE_RELEASE=$(curl -sX GET "https://api.github.com/repos/ciur/papermerge/releases/latest" \ - | awk '/tag_name/{print $4;exit}' FS='[""]'); \ - fi && \ - curl -o \ - /tmp/papermerge.tar.gz -L \ - "https://github.com/ciur/papermerge/archive/${PAPERMERGE_RELEASE}.tar.gz" && \ - tar xf \ - /tmp/papermerge.tar.gz -C \ - /app/papermerge/ --strip-components=1 && \ - echo "**** install pip packages ****" && \ - cd /app/papermerge && \ - pip3 install --no-cache-dir --find-links https://wheel-index.linuxserver.io/ubuntu/ django==3.1.7 && \ - pip3 install --no-cache-dir --find-links https://wheel-index.linuxserver.io/ubuntu/ -r ./requirements/base.txt && \ - pip3 install --no-cache-dir --find-links https://wheel-index.linuxserver.io/ubuntu/ -r ./requirements/production.txt && \ - pip3 install --no-cache-dir --find-links https://wheel-index.linuxserver.io/ubuntu/ -r ./requirements/extra/mysql.txt && \ - pip3 install --no-cache-dir --find-links https://wheel-index.linuxserver.io/ubuntu/ -r ./requirements/extra/pg.txt && \ - echo "**** cleanup ****" && \ - apt-get purge -y --auto-remove \ - $BUILD_PACKAGES && \ - rm -rf \ - /root/.cache \ - /tmp/* && \ - apt-get clean -y - # copy local files COPY root/ / diff --git a/Dockerfile.aarch64 b/Dockerfile.aarch64 index 78bf1f9..81f8043 100644 --- a/Dockerfile.aarch64 +++ b/Dockerfile.aarch64 @@ -1,3 +1,5 @@ +# syntax=docker/dockerfile:1 + FROM ghcr.io/linuxserver/baseimage-ubuntu:arm64v8-focal # set version label @@ -7,80 +9,6 @@ ARG PAPERMERGE_RELEASE LABEL build_version="Linuxserver.io version:- ${VERSION} Build-date:- ${BUILD_DATE}" LABEL maintainer="alex-phillips" -# ensures our console output looks familiar and is not buffered by Docker -ENV PYTHONUNBUFFERED 1 -ENV DJANGO_SETTINGS_MODULE config.settings.production -ARG DEBIAN_FRONTEND="noninteractive" - -# NOTE: the additional lib and python dependencies are for the ARM builds -ARG BUILD_PACKAGES="\ - apache2-dev \ - build-essential \ - git \ - libffi-dev \ - libpq-dev \ - libmariadbclient-dev \ - libxml2-dev \ - libxslt-dev \ - python3-dev \ - python3-pip" - -# packages as variables -ARG RUNTIME_PACKAGES="\ - imagemagick \ - libmariadb3 \ - libpq5 \ - libxslt1.1 \ - poppler-utils \ - python3 \ - python3-cryptography \ - python3-distutils \ - python3-mysqldb \ - python3-psycopg2 \ - python3-setuptools \ - redis \ - tesseract-ocr \ - tesseract-ocr-eng \ - uwsgi \ - uwsgi-plugin-python3" - -RUN \ - apt-get update && \ - echo "**** install build packages ****" && \ - apt-get install -y \ - --no-install-recommends \ - $BUILD_PACKAGES && \ - echo "**** install runtime packages ****" && \ - apt-get install -y \ - --no-install-recommends \ - $RUNTIME_PACKAGES && \ - echo "**** install papermerge ****" && \ - mkdir -p /app/papermerge && \ - if [ -z ${PAPERMERGE_RELEASE+x} ]; then \ - PAPERMERGE_RELEASE=$(curl -sX GET "https://api.github.com/repos/ciur/papermerge/releases/latest" \ - | awk '/tag_name/{print $4;exit}' FS='[""]'); \ - fi && \ - curl -o \ - /tmp/papermerge.tar.gz -L \ - "https://github.com/ciur/papermerge/archive/${PAPERMERGE_RELEASE}.tar.gz" && \ - tar xf \ - /tmp/papermerge.tar.gz -C \ - /app/papermerge/ --strip-components=1 && \ - echo "**** install pip packages ****" && \ - cd /app/papermerge && \ - pip3 install --no-cache-dir --find-links https://wheel-index.linuxserver.io/ubuntu/ django==3.1.7 && \ - pip3 install --no-cache-dir --find-links https://wheel-index.linuxserver.io/ubuntu/ -r ./requirements/base.txt && \ - pip3 install --no-cache-dir --find-links https://wheel-index.linuxserver.io/ubuntu/ -r ./requirements/production.txt && \ - pip3 install --no-cache-dir --find-links https://wheel-index.linuxserver.io/ubuntu/ -r ./requirements/extra/mysql.txt && \ - pip3 install --no-cache-dir --find-links https://wheel-index.linuxserver.io/ubuntu/ -r ./requirements/extra/pg.txt && \ - echo "**** cleanup ****" && \ - apt-get purge -y --auto-remove \ - $BUILD_PACKAGES && \ - rm -rf \ - /root/.cache \ - /tmp/* && \ - apt-get clean -y - # copy local files COPY root/ / diff --git a/Dockerfile.armhf b/Dockerfile.armhf index 7150d9b..bc230b0 100644 --- a/Dockerfile.armhf +++ b/Dockerfile.armhf @@ -1,3 +1,5 @@ +# syntax=docker/dockerfile:1 + FROM ghcr.io/linuxserver/baseimage-ubuntu:arm32v7-focal # set version label @@ -7,80 +9,6 @@ ARG PAPERMERGE_RELEASE LABEL build_version="Linuxserver.io version:- ${VERSION} Build-date:- ${BUILD_DATE}" LABEL maintainer="alex-phillips" -# ensures our console output looks familiar and is not buffered by Docker -ENV PYTHONUNBUFFERED 1 -ENV DJANGO_SETTINGS_MODULE config.settings.production -ARG DEBIAN_FRONTEND="noninteractive" - -# NOTE: the additional lib and python dependencies are for the ARM builds -ARG BUILD_PACKAGES="\ - apache2-dev \ - build-essential \ - git \ - libffi-dev \ - libpq-dev \ - libmariadbclient-dev \ - libxml2-dev \ - libxslt-dev \ - python3-dev \ - python3-pip" - -# packages as variables -ARG RUNTIME_PACKAGES="\ - imagemagick \ - libmariadb3 \ - libpq5 \ - libxslt1.1 \ - poppler-utils \ - python3 \ - python3-cryptography \ - python3-distutils \ - python3-mysqldb \ - python3-psycopg2 \ - python3-setuptools \ - redis \ - tesseract-ocr \ - tesseract-ocr-eng \ - uwsgi \ - uwsgi-plugin-python3" - -RUN \ - apt-get update && \ - echo "**** install build packages ****" && \ - apt-get install -y \ - --no-install-recommends \ - $BUILD_PACKAGES && \ - echo "**** install runtime packages ****" && \ - apt-get install -y \ - --no-install-recommends \ - $RUNTIME_PACKAGES && \ - echo "**** install papermerge ****" && \ - mkdir -p /app/papermerge && \ - if [ -z ${PAPERMERGE_RELEASE+x} ]; then \ - PAPERMERGE_RELEASE=$(curl -sX GET "https://api.github.com/repos/ciur/papermerge/releases/latest" \ - | awk '/tag_name/{print $4;exit}' FS='[""]'); \ - fi && \ - curl -o \ - /tmp/papermerge.tar.gz -L \ - "https://github.com/ciur/papermerge/archive/${PAPERMERGE_RELEASE}.tar.gz" && \ - tar xf \ - /tmp/papermerge.tar.gz -C \ - /app/papermerge/ --strip-components=1 && \ - echo "**** install pip packages ****" && \ - cd /app/papermerge && \ - pip3 install --no-cache-dir --find-links https://wheel-index.linuxserver.io/ubuntu/ django==3.1.7 && \ - pip3 install --no-cache-dir --find-links https://wheel-index.linuxserver.io/ubuntu/ -r ./requirements/base.txt && \ - pip3 install --no-cache-dir --find-links https://wheel-index.linuxserver.io/ubuntu/ -r ./requirements/production.txt && \ - pip3 install --no-cache-dir --find-links https://wheel-index.linuxserver.io/ubuntu/ -r ./requirements/extra/mysql.txt && \ - pip3 install --no-cache-dir --find-links https://wheel-index.linuxserver.io/ubuntu/ -r ./requirements/extra/pg.txt && \ - echo "**** cleanup ****" && \ - apt-get purge -y --auto-remove \ - $BUILD_PACKAGES && \ - rm -rf \ - /root/.cache \ - /tmp/* && \ - apt-get clean -y - # copy local files COPY root/ / diff --git a/readme-vars.yml b/readme-vars.yml index 9f93edd..3e78245 100644 --- a/readme-vars.yml +++ b/readme-vars.yml @@ -6,9 +6,15 @@ project_url: "https://www.papermerge.com/" project_logo: "https://raw.githubusercontent.com/linuxserver/docker-templates/master/linuxserver.io/img/papermerge-icon.png" project_blurb: | [{{ project_name|capitalize }}]({{ project_url }}) is an open source document management system (DMS) primarily designed for archiving and retrieving your digital documents. Instead of having piles of paper documents all over your desk, office or drawers - you can quickly scan them and configure your scanner to directly upload to Papermerge DMS." - project_lsio_github_repo_url: "https://github.com/linuxserver/docker-{{ project_name }}" +project_deprecation_status: true +project_deprecation_message: | + The last working tag is: + v2.0.1-ls60 + We recommend the official image instead: + https://hub.docker.com/r/papermerge/papermerge + # supported architectures available_architectures: - { arch: "{{ arch_x86_64 }}", tag: "amd64-latest"} @@ -43,8 +49,10 @@ app_setup_block: | More info at [papermerge]({{ project_url }}). If you need non-English OCR language support, you can use [this mod](https://github.com/linuxserver/docker-mods/tree/papermerge-multilangocr). + # changelog changelogs: + - { date: "15.02.23:", desc: "Deprecate image." } - { date: "15.07.22:", desc: "Don't install development python packages" } - { date: "13.04.21:", desc: "Handle upstream stapler change" } - { date: "13.03.21:", desc: "Fixed mglib dependency per issue 32"} From 21f253a27e04d00a56fa9213cc4dfe7116522779 Mon Sep 17 00:00:00 2001 From: TheSpad Date: Wed, 15 Feb 2023 15:10:34 +0000 Subject: [PATCH 2/2] Remove init files & add dummy placeholder --- root/defaults/papermerge.conf.py | 18 -------- root/defaults/redis.conf | 1 - root/defaults/settings.py | 72 ------------------------------ root/defaults/uwsgi.ini | 8 ---- root/etc/cont-init.d/50-config | 56 ----------------------- root/etc/dummy | 0 root/etc/services.d/papermerge/run | 6 --- root/etc/services.d/redis/run | 6 --- 8 files changed, 167 deletions(-) delete mode 100644 root/defaults/papermerge.conf.py delete mode 100644 root/defaults/redis.conf delete mode 100644 root/defaults/settings.py delete mode 100644 root/defaults/uwsgi.ini delete mode 100644 root/etc/cont-init.d/50-config create mode 100644 root/etc/dummy delete mode 100644 root/etc/services.d/papermerge/run delete mode 100644 root/etc/services.d/redis/run diff --git a/root/defaults/papermerge.conf.py b/root/defaults/papermerge.conf.py deleted file mode 100644 index 72c6539..0000000 --- a/root/defaults/papermerge.conf.py +++ /dev/null @@ -1,18 +0,0 @@ -#DBTYPE = "mariadb" # Uncomment this to enable an external DB instead of local SQLite, refer to Papermerge docs -DBUSER = "root" -DBPASS = "root" -DBHOST = "mariadb" -DBNAME = "papermerge" - -MEDIA_DIR = "/data/media" -STATIC_DIR = "/app/papermerge/static" -MEDIA_URL = "/media/" -STATIC_URL = "/static/" - -BINARY_STAPLER = "/usr/local/bin/stapler" - -OCR_DEFAULT_LANGUAGE = "eng" - -OCR_LANGUAGES = { - "eng": "English", -} diff --git a/root/defaults/redis.conf b/root/defaults/redis.conf deleted file mode 100644 index b66f312..0000000 --- a/root/defaults/redis.conf +++ /dev/null @@ -1 +0,0 @@ -dir /redis diff --git a/root/defaults/settings.py b/root/defaults/settings.py deleted file mode 100644 index 051c82d..0000000 --- a/root/defaults/settings.py +++ /dev/null @@ -1,72 +0,0 @@ -from .base import * # noqa - -DEBUG = False -# debug variable in templates is available only if INTERNAL_IPS are set -# to a not empty list -INTERNAL_IPS = [ - '127.0.0.1', -] - -ALLOWED_HOSTS = ['*'] - -INSTALLED_APPS.extend( - ['mod_wsgi.server', ] -) - -# DATABASES = { -# 'default': { -# 'ENGINE': 'django.db.backends.postgresql', -# 'NAME': 'dbname', -# 'USER': 'dbuser', -# 'PASSWORD': 'dbpass', -# 'HOST': 'db', -# 'PORT': 5432, -# }, -# } - -# DATABASES = { -# 'default': { -# 'ENGINE': 'django.db.backends.mysql', -# 'NAME': 'dbname', -# 'USER': 'dbuser', -# 'PASSWORD': 'dbpass', -# 'HOST': 'db', -# 'PORT': 3306, -# }, -# } - -DATABASES = { - "default": { - "ENGINE": "django.db.backends.sqlite3", - "NAME": "/data/papermerge.db", - } -} - -LOGGING = { - 'version': 1, - 'disable_existing_loggers': False, - 'handlers': { - 'file_worker': { - 'class': 'logging.FileHandler', - 'filename': 'worker.log', - }, - 'file_app': { - 'class': 'logging.FileHandler', - 'filename': 'app.log', - }, - }, - 'loggers': { - 'mglib': { - 'handlers': ['file_app'], - 'level': 'DEBUG' - }, - 'papermerge': { - 'handlers': ['file_app'], - 'level': 'DEBUG' - }, - 'celery': { - 'handlers': ['file_worker'], - 'level': 'INFO' - }, - }, -} diff --git a/root/defaults/uwsgi.ini b/root/defaults/uwsgi.ini deleted file mode 100644 index d386cb7..0000000 --- a/root/defaults/uwsgi.ini +++ /dev/null @@ -1,8 +0,0 @@ -[uwsgi] -http-socket = :8000 -enable-threads -plugin = python3 -module = config.wsgi:application -static-map = /static=/app/papermerge/static -static-gzip-dir = static-collected/CACHE -attach-daemon = /usr/bin/python3 ./manage.py worker diff --git a/root/etc/cont-init.d/50-config b/root/etc/cont-init.d/50-config deleted file mode 100644 index e4377e5..0000000 --- a/root/etc/cont-init.d/50-config +++ /dev/null @@ -1,56 +0,0 @@ -#!/usr/bin/with-contenv bash - -export DJANGO_SETTINGS_MODULE=config.settings.production - -# configure redis options -if [[ -v "$REDIS_URL" ]]; then - rm -rf /etc/services.d/redis - printf '%s\n' '' 'CELERY_BROKER_URL = "redis://$REDIS_URL"' 'CELERY_BROKER_TRANSPORT_OPTIONS = {}' 'CELERY_RESULT_BACKEND = "redis://$REDIS_URL"' >> /defaults/settings.py -else - printf '%s\n' '' 'CELERY_BROKER_URL = "redis://localhost"' 'CELERY_BROKER_TRANSPORT_OPTIONS = {}' 'CELERY_RESULT_BACKEND = "redis://localhost"' >> /defaults/settings.py -fi - -mkdir -p /data/{media,queue,static} - -if [ ! -f "/config/settings.py" ]; then - cp /defaults/settings.py /config/settings.py -fi - -if [ ! -f "/config/papermerge.conf.py" ]; then - cp /defaults/papermerge.conf.py /config/papermerge.conf.py -fi - -ln -sf /config/settings.py /app/papermerge/config/settings/production.py -ln -sf /config/papermerge.conf.py /app/papermerge/papermerge.conf.py - -cd /app/papermerge -python3 ./manage.py makemigrations -python3 ./manage.py migrate - -python3 ./manage.py collectstatic --no-input -python3 ./manage.py check - -mv /defaults/uwsgi.ini /app/papermerge > /dev/null - -if ! grep -q BINARY_STAPLER /config/papermerge.conf.py; then - echo "BINARY_STAPLER = \"/usr/local/bin/stapler\"" >> /config/papermerge.conf.py -fi - -# permissions -chown -R abc:abc \ - /app/papermerge \ - /config \ - /data - -cat << EOF | s6-setuidgid abc python3 /app/papermerge/manage.py shell -from django.contrib.auth import get_user_model - -# see ref. below -UserModel = get_user_model() - -if not UserModel.objects.filter(username='admin').exists(): - user = UserModel.objects.create_user('admin', password='admin') - user.is_superuser = True - user.is_staff = True - user.save() -EOF diff --git a/root/etc/dummy b/root/etc/dummy new file mode 100644 index 0000000..e69de29 diff --git a/root/etc/services.d/papermerge/run b/root/etc/services.d/papermerge/run deleted file mode 100644 index b9450f5..0000000 --- a/root/etc/services.d/papermerge/run +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/with-contenv bash - -cd /app/papermerge || exit - -exec \ - s6-setuidgid abc /usr/bin/uwsgi uwsgi.ini diff --git a/root/etc/services.d/redis/run b/root/etc/services.d/redis/run deleted file mode 100644 index 376a9e5..0000000 --- a/root/etc/services.d/redis/run +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/with-contenv bash - -mkdir -p /redis - -exec \ - s6-setuidgid abc /usr/bin/redis-server /defaults/redis.conf