commit 996ba9de354e0ae90fe88f51a015d87bc9077ada Author: Sebastian Hugentobler Date: Wed Aug 30 18:24:33 2023 +0200 initial commit diff --git a/.gitignore b/.gitignore new file mode 100755 index 0000000..af0faab --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +*~ +.DS_Store +*.swp diff --git a/.woodpecker.yml b/.woodpecker.yml new file mode 100644 index 0000000..aa99300 --- /dev/null +++ b/.woodpecker.yml @@ -0,0 +1,12 @@ +pipeline: + publish-docker-image: + image: plugins/kaniko + settings: + repo: docker.io/thallian/paperless-ngx + tags: latest,${CI_COMMIT_SHA:0:8},${CI_COMMIT_TAG=pre} + dockerfile: Dockerfile + username: + from_secret: DOCKER_USER + password: + from_secret: DOCKER_PW + diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..5b3a02b --- /dev/null +++ b/Dockerfile @@ -0,0 +1,53 @@ +FROM docker.io/alpine:3.18 AS builder + +RUN apk add --no-cache \ + python3-dev \ + make \ + g++ \ + musl-dev \ + libpq-dev \ + freetype-dev \ + qpdf-dev + +ENV VERSION=v1.17.2 +ENV ARCHIVE=paperless-ngx-$VERSION.tar.xz +ENV SHA256_SUM=a4b47e4fc6ff2321a2f616fcfeec2740f1866c555fa5bc9d47da85e31e8c05dd +RUN wget https://github.com/paperless-ngx/paperless-ngx/releases/download/$VERSION/$ARCHIVE +RUN echo "$SHA256_SUM $ARCHIVE" | sha256sum -c - || exit 1 +RUN mkdir -p /install +RUN tar xf $ARCHIVE -C /install --strip 1 + +WORKDIR /install +RUN sed '/mysqlclient/d' -i requirements.txt +RUN sed 's/scipy==1.8.1/scipy==1.11.2/g' -i requirements.txt +RUN python3 -m venv env +RUN env/bin/pip3 install -r requirements.txt + + +FROM docker.io/thallian/alpine-s6:3.18-3.1.5.0 + +RUN addgroup -g 2222 paperless +RUN adduser -h /var/lib/paperless -u 2222 -D -G paperless paperless + +RUN apk add --no-cache \ + python3 \ + libpq \ + freetype \ + qpdf \ + imagemagick \ + ghostscript \ + libmagic \ + gpg \ + tesseract-ocr \ + tesseract-ocr-data-deu \ + tesseract-ocr-data-eng + +COPY --from=builder /install /var/lib/paperless + +ADD /rootfs / + +RUN chown -R paperless:paperless /var/lib/paperless +ENV HOME /var/lib/paperless + +VOLUME ["/var/lib/paperless/media", "/var/lib/paperless/consume", "/var/lib/paperless/data"] +EXPOSE 8000 diff --git a/README.md b/README.md new file mode 100644 index 0000000..d75ac39 --- /dev/null +++ b/README.md @@ -0,0 +1,16 @@ +[paperless-ngx](https://github.com/paperless-ngx/paperless-ngx) document +management system. + +# Volumes + +- `/var/lib/paperless/media/` +- `/var/lib/paperless/consume/` + +# Environment Variables + +Refer to the [documentation](https://docs.paperless-ngx.com/configuration) for +possible configurations. + +# Ports + +- 8000 diff --git a/rootfs/bin/db-migration b/rootfs/bin/db-migration new file mode 100755 index 0000000..bba020d --- /dev/null +++ b/rootfs/bin/db-migration @@ -0,0 +1,2 @@ +#!/bin/sh +s6-setuidgid paperless ~/env/bin/python3 ~/src/manage.py migrate diff --git a/rootfs/etc/s6-overlay/s6-rc.d/consumer/dependencies b/rootfs/etc/s6-overlay/s6-rc.d/consumer/dependencies new file mode 100644 index 0000000..abe4760 --- /dev/null +++ b/rootfs/etc/s6-overlay/s6-rc.d/consumer/dependencies @@ -0,0 +1 @@ +db-migration diff --git a/rootfs/etc/s6-overlay/s6-rc.d/consumer/run b/rootfs/etc/s6-overlay/s6-rc.d/consumer/run new file mode 100644 index 0000000..5006fbc --- /dev/null +++ b/rootfs/etc/s6-overlay/s6-rc.d/consumer/run @@ -0,0 +1,3 @@ +#!/bin/sh + +s6-setuidgid paperless ~/env/bin/python3 ~/src/manage.py document_consumer diff --git a/rootfs/etc/s6-overlay/s6-rc.d/consumer/type b/rootfs/etc/s6-overlay/s6-rc.d/consumer/type new file mode 100644 index 0000000..5883cff --- /dev/null +++ b/rootfs/etc/s6-overlay/s6-rc.d/consumer/type @@ -0,0 +1 @@ +longrun diff --git a/rootfs/etc/s6-overlay/s6-rc.d/db-migration/dependencies b/rootfs/etc/s6-overlay/s6-rc.d/db-migration/dependencies new file mode 100644 index 0000000..e69de29 diff --git a/rootfs/etc/s6-overlay/s6-rc.d/db-migration/type b/rootfs/etc/s6-overlay/s6-rc.d/db-migration/type new file mode 100644 index 0000000..bdd22a1 --- /dev/null +++ b/rootfs/etc/s6-overlay/s6-rc.d/db-migration/type @@ -0,0 +1 @@ +oneshot diff --git a/rootfs/etc/s6-overlay/s6-rc.d/db-migration/up b/rootfs/etc/s6-overlay/s6-rc.d/db-migration/up new file mode 100644 index 0000000..abe4760 --- /dev/null +++ b/rootfs/etc/s6-overlay/s6-rc.d/db-migration/up @@ -0,0 +1 @@ +db-migration diff --git a/rootfs/etc/s6-overlay/s6-rc.d/scheduler/dependencies b/rootfs/etc/s6-overlay/s6-rc.d/scheduler/dependencies new file mode 100644 index 0000000..abe4760 --- /dev/null +++ b/rootfs/etc/s6-overlay/s6-rc.d/scheduler/dependencies @@ -0,0 +1 @@ +db-migration diff --git a/rootfs/etc/s6-overlay/s6-rc.d/scheduler/run b/rootfs/etc/s6-overlay/s6-rc.d/scheduler/run new file mode 100644 index 0000000..05190c6 --- /dev/null +++ b/rootfs/etc/s6-overlay/s6-rc.d/scheduler/run @@ -0,0 +1,4 @@ +#!/bin/sh + +cd /var/lib/paperless/src || exit +s6-setuidgid paperless ~/env/bin/python3 ~/env/bin/celery --app paperless beat --loglevel INFO diff --git a/rootfs/etc/s6-overlay/s6-rc.d/scheduler/type b/rootfs/etc/s6-overlay/s6-rc.d/scheduler/type new file mode 100644 index 0000000..5883cff --- /dev/null +++ b/rootfs/etc/s6-overlay/s6-rc.d/scheduler/type @@ -0,0 +1 @@ +longrun diff --git a/rootfs/etc/s6-overlay/s6-rc.d/task-queue/dependencies b/rootfs/etc/s6-overlay/s6-rc.d/task-queue/dependencies new file mode 100644 index 0000000..abe4760 --- /dev/null +++ b/rootfs/etc/s6-overlay/s6-rc.d/task-queue/dependencies @@ -0,0 +1 @@ +db-migration diff --git a/rootfs/etc/s6-overlay/s6-rc.d/task-queue/run b/rootfs/etc/s6-overlay/s6-rc.d/task-queue/run new file mode 100644 index 0000000..af6c3be --- /dev/null +++ b/rootfs/etc/s6-overlay/s6-rc.d/task-queue/run @@ -0,0 +1,4 @@ +#!/bin/sh + +cd /var/lib/paperless/src || exit +s6-setuidgid paperless ~/env/bin/python3 ~/env/bin/celery --app paperless worker --loglevel INFO diff --git a/rootfs/etc/s6-overlay/s6-rc.d/task-queue/type b/rootfs/etc/s6-overlay/s6-rc.d/task-queue/type new file mode 100644 index 0000000..5883cff --- /dev/null +++ b/rootfs/etc/s6-overlay/s6-rc.d/task-queue/type @@ -0,0 +1 @@ +longrun diff --git a/rootfs/etc/s6-overlay/s6-rc.d/user/contents.d/consumer b/rootfs/etc/s6-overlay/s6-rc.d/user/contents.d/consumer new file mode 100644 index 0000000..e69de29 diff --git a/rootfs/etc/s6-overlay/s6-rc.d/user/contents.d/scheduler b/rootfs/etc/s6-overlay/s6-rc.d/user/contents.d/scheduler new file mode 100644 index 0000000..e69de29 diff --git a/rootfs/etc/s6-overlay/s6-rc.d/user/contents.d/task-queue b/rootfs/etc/s6-overlay/s6-rc.d/user/contents.d/task-queue new file mode 100644 index 0000000..e69de29 diff --git a/rootfs/etc/s6-overlay/s6-rc.d/user/contents.d/webserver b/rootfs/etc/s6-overlay/s6-rc.d/user/contents.d/webserver new file mode 100644 index 0000000..e69de29 diff --git a/rootfs/etc/s6-overlay/s6-rc.d/webserver/dependencies b/rootfs/etc/s6-overlay/s6-rc.d/webserver/dependencies new file mode 100644 index 0000000..abe4760 --- /dev/null +++ b/rootfs/etc/s6-overlay/s6-rc.d/webserver/dependencies @@ -0,0 +1 @@ +db-migration diff --git a/rootfs/etc/s6-overlay/s6-rc.d/webserver/run b/rootfs/etc/s6-overlay/s6-rc.d/webserver/run new file mode 100644 index 0000000..132cb9c --- /dev/null +++ b/rootfs/etc/s6-overlay/s6-rc.d/webserver/run @@ -0,0 +1,4 @@ +#!/bin/sh + +cd /var/lib/paperless/src || exit +s6-setuidgid paperless ~/env/bin/python3 ~/env/bin/gunicorn -c ~/gunicorn.conf.py paperless.asgi:application diff --git a/rootfs/etc/s6-overlay/s6-rc.d/webserver/type b/rootfs/etc/s6-overlay/s6-rc.d/webserver/type new file mode 100644 index 0000000..5883cff --- /dev/null +++ b/rootfs/etc/s6-overlay/s6-rc.d/webserver/type @@ -0,0 +1 @@ +longrun