From c32286ef21f3d72fd6f17c69efeb61394ad9eae0 Mon Sep 17 00:00:00 2001 From: idrainformatica Date: Fri, 5 Dec 2025 11:26:55 +0100 Subject: [PATCH] v1 dockerfile --- CODEOWNERS | 10 - Tree structure loghi.txt | 48 ++++ docker/compose/Dockerfile | 268 ++++++++++++++++++ docker/compose/docker-compose.ci-test.yml | 25 -- .../compose/docker-compose.mariadb-tika.yml | 90 ------ docker/compose/docker-compose.mariadb.yml | 69 ----- docker/compose/docker-compose.portainer.yml | 65 ----- .../compose/docker-compose.postgres-tika.yml | 84 ------ docker/compose/docker-compose.sqlite-tika.yml | 72 ----- docker/compose/docker-compose.sqlite.yml | 48 ---- ...ompose.postgres.yml => docker-compose.yml} | 19 +- 11 files changed, 330 insertions(+), 468 deletions(-) delete mode 100644 CODEOWNERS create mode 100644 Tree structure loghi.txt create mode 100644 docker/compose/Dockerfile delete mode 100644 docker/compose/docker-compose.ci-test.yml delete mode 100644 docker/compose/docker-compose.mariadb-tika.yml delete mode 100644 docker/compose/docker-compose.mariadb.yml delete mode 100644 docker/compose/docker-compose.portainer.yml delete mode 100644 docker/compose/docker-compose.postgres-tika.yml delete mode 100644 docker/compose/docker-compose.sqlite-tika.yml delete mode 100644 docker/compose/docker-compose.sqlite.yml rename docker/compose/{docker-compose.postgres.yml => docker-compose.yml} (83%) diff --git a/CODEOWNERS b/CODEOWNERS deleted file mode 100644 index f942cd4..0000000 --- a/CODEOWNERS +++ /dev/null @@ -1,10 +0,0 @@ -/.github/workflows/ @paperless-ngx/ci-cd -/docker/ @paperless-ngx/ci-cd -/scripts/ @paperless-ngx/ci-cd - -/src-ui/ @paperless-ngx/frontend - -/src/ @paperless-ngx/backend -pyproject.toml @paperless-ngx/backend -uv.lock @paperless-ngx/backend -*.py @paperless-ngx/backend diff --git a/Tree structure loghi.txt b/Tree structure loghi.txt new file mode 100644 index 0000000..ca3b491 --- /dev/null +++ b/Tree structure loghi.txt @@ -0,0 +1,48 @@ +📁 APPLICATION LOGO FILES (USED IN DOCKER BUILD) +│ +├── 📁 src-ui/ (Frontend - Angular Application) +│ ├── src/favicon.ico ⚠️ Main favicon +│ ├── apple-touch-icon.png ⚠️ iOS/Apple devices icon +│ └── src/assets/ +│ ├── logo.svg ⚠️ Primary logo (with text) +│ ├── logo-notext.svg ⚠️ Icon only +│ ├── logo-dark.svg ⚠️ Dark theme logo +│ ├── logo-dark-notext.svg ⚠️ Dark theme icon +│ └── logo-white-notext.svg ⚠️ White version icon +│ +├── 📁 src/paperless/static/paperless/img/ (Backend Static) +│ ├── favicon.ico ⚠️ Backend favicon +│ ├── logo-dark.png ⚠️ Dark theme PNG +│ └── logo-light.png ⚠️ Light theme PNG +│ +└── 📁 src/documents/templates/paperless-ngx/snippets/ + └── svg_logo.html (SVG logo template) + +📁 DOCUMENTATION FILES (NOT in Docker build) +│ +└── 📁 docs/assets/ + ├── favicon.png (MkDocs documentation favicon) + ├── logo.svg + ├── logo_full_black.svg + └── logo_full_white.svg + +📁 RESOURCES (EXCLUDED from Docker - see .dockerignore) +│ +└── 📁 resources/logo/ + ├── logo.txt + ├── web/ + │ ├── svg/ + │ │ ├── Black logo - no background.svg + │ │ ├── Color logo - no background.svg + │ │ ├── Color logo with background.svg + │ │ ├── square.svg + │ │ └── White logo - no background.svg + │ └── png/ + │ ├── Black logo - no background.png + │ ├── Color logo - no background.png + │ ├── Color logo with background.png + │ └── White logo - no background.png + └── print/ + ├── pdf/ (4 logo variants) + └── eps/ (4 logo variants) + diff --git a/docker/compose/Dockerfile b/docker/compose/Dockerfile new file mode 100644 index 0000000..8dbfc71 --- /dev/null +++ b/docker/compose/Dockerfile @@ -0,0 +1,268 @@ +# syntax=docker/dockerfile:1 +# https://github.com/moby/buildkit/blob/master/frontend/dockerfile/docs/reference.md + +# Stage: compile-frontend +# Purpose: Compiles the frontend +# Notes: +# - Does PNPM stuff with Typescript and such +FROM --platform=$BUILDPLATFORM docker.io/node:20-bookworm-slim AS compile-frontend + +COPY ./src-ui /src/src-ui + +WORKDIR /src/src-ui +RUN set -eux \ + && npm update -g pnpm \ + && npm install -g corepack@latest \ + && corepack enable \ + && pnpm install + +ARG PNGX_TAG_VERSION= +# Add the tag to the environment file if its a tagged dev build +RUN set -eux && \ +case "${PNGX_TAG_VERSION}" in \ + dev|beta|fix*|feature*) \ + sed -i -E "s/tag: '([a-z\.]+)'/tag: '${PNGX_TAG_VERSION}'/g" /src/src-ui/src/environments/environment.prod.ts \ + ;; \ +esac + +RUN set -eux \ + && ./node_modules/.bin/ng build --configuration production + +# Stage: s6-overlay-base +# Purpose: Installs s6-overlay and rootfs +# Comments: +# - Don't leave anything extra in here either +FROM ghcr.io/astral-sh/uv:0.8.22-python3.12-bookworm-slim AS s6-overlay-base + +WORKDIR /usr/src/s6 + +# https://github.com/just-containers/s6-overlay#customizing-s6-overlay-behaviour +ENV \ + S6_BEHAVIOUR_IF_STAGE2_FAILS=2 \ + S6_CMD_WAIT_FOR_SERVICES_MAXTIME=0 \ + S6_VERBOSITY=1 \ + PATH=/command:$PATH + +# Buildx provided, must be defined to use though +ARG TARGETARCH +ARG TARGETVARIANT +# Lock this version +ARG S6_OVERLAY_VERSION=3.2.1.0 + +ARG S6_BUILD_TIME_PKGS="curl \ + xz-utils" + +RUN set -eux \ + && echo "Installing build time packages" \ + && apt-get update \ + && apt-get install --yes --quiet --no-install-recommends ${S6_BUILD_TIME_PKGS} \ + && echo "Determining arch" \ + && S6_ARCH="" \ + && if [ "${TARGETARCH}${TARGETVARIANT}" = "amd64" ]; then S6_ARCH="x86_64"; \ + elif [ "${TARGETARCH}${TARGETVARIANT}" = "arm64" ]; then S6_ARCH="aarch64"; fi\ + && if [ -z "${S6_ARCH}" ]; then { echo "Error: Not able to determine arch"; exit 1; }; fi \ + && echo "Installing s6-overlay for ${S6_ARCH}" \ + && curl --fail --silent --no-progress-meter --show-error --location --remote-name-all --parallel --parallel-max 4 \ + "https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-noarch.tar.xz" \ + "https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-noarch.tar.xz.sha256" \ + "https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-${S6_ARCH}.tar.xz" \ + "https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-${S6_ARCH}.tar.xz.sha256" \ + && echo "Validating s6-archive checksums" \ + && sha256sum --check ./*.sha256 \ + && echo "Unpacking archives" \ + && tar --directory / -Jxpf s6-overlay-noarch.tar.xz \ + && tar --directory / -Jxpf s6-overlay-${S6_ARCH}.tar.xz \ + && echo "Removing downloaded archives" \ + && rm ./*.tar.xz \ + && rm ./*.sha256 \ + && echo "Cleaning up image" \ + && apt-get --yes purge ${S6_BUILD_TIME_PKGS} \ + && apt-get --yes autoremove --purge \ + && rm -rf /var/lib/apt/lists/* + +# Copy our service defs and filesystem +COPY ./docker/rootfs / + +# Stage: main-app +# Purpose: The final image +# Comments: +# - Don't leave anything extra in here +FROM s6-overlay-base AS main-app + +LABEL org.opencontainers.image.authors="paperless-ngx team " +LABEL org.opencontainers.image.documentation="https://docs.paperless-ngx.com/" +LABEL org.opencontainers.image.source="https://github.com/paperless-ngx/paperless-ngx" +LABEL org.opencontainers.image.url="https://github.com/paperless-ngx/paperless-ngx" +LABEL org.opencontainers.image.licenses="GPL-3.0-only" + +ARG DEBIAN_FRONTEND=noninteractive + +# Buildx provided, must be defined to use though +ARG TARGETARCH + +# Can be workflow provided, defaults set for manual building +ARG JBIG2ENC_VERSION=0.30 +ARG QPDF_VERSION=11.9.0 +ARG GS_VERSION=10.03.1 + +# Set Python environment variables +ENV PYTHONDONTWRITEBYTECODE=1 \ + PYTHONUNBUFFERED=1 \ + # Ignore warning from Whitenoise about async iterators + PYTHONWARNINGS="ignore:::django.http.response:517" \ + PNGX_CONTAINERIZED=1 \ + # https://docs.astral.sh/uv/reference/settings/#link-mode + UV_LINK_MODE=copy \ + UV_CACHE_DIR=/cache/uv/ + +# +# Begin installation and configuration +# Order the steps below from least often changed to most +# + +# Packages need for running +ARG RUNTIME_PACKAGES="\ + # General utils + curl \ + # Docker specific + gosu \ + # Timezones support + tzdata \ + # fonts for text file thumbnail generation + fonts-liberation \ + gettext \ + ghostscript \ + gnupg \ + icc-profiles-free \ + imagemagick \ + # PostgreSQL + postgresql-client \ + # MySQL / MariaDB + mariadb-client \ + # OCRmyPDF dependencies + tesseract-ocr \ + tesseract-ocr-eng \ + tesseract-ocr-deu \ + tesseract-ocr-fra \ + tesseract-ocr-ita \ + tesseract-ocr-spa \ + unpaper \ + pngquant \ + jbig2dec \ + # lxml + libxml2 \ + libxslt1.1 \ + # itself + qpdf \ + # Mime type detection + file \ + libmagic1 \ + media-types \ + zlib1g \ + # Barcode splitter + libzbar0 \ + poppler-utils" + +# Install basic runtime packages. +# These change very infrequently +RUN set -eux \ + echo "Installing system packages" \ + && apt-get update \ + && apt-get install --yes --quiet --no-install-recommends ${RUNTIME_PACKAGES} \ + && echo "Installing pre-built updates" \ + && curl --fail --silent --no-progress-meter --show-error --location --remote-name-all --parallel --parallel-max 4 \ + https://github.com/paperless-ngx/builder/releases/download/qpdf-${QPDF_VERSION}/libqpdf29_${QPDF_VERSION}-1_${TARGETARCH}.deb \ + https://github.com/paperless-ngx/builder/releases/download/qpdf-${QPDF_VERSION}/qpdf_${QPDF_VERSION}-1_${TARGETARCH}.deb \ + https://github.com/paperless-ngx/builder/releases/download/ghostscript-${GS_VERSION}/libgs10_${GS_VERSION}.dfsg-1_${TARGETARCH}.deb \ + https://github.com/paperless-ngx/builder/releases/download/ghostscript-${GS_VERSION}/ghostscript_${GS_VERSION}.dfsg-1_${TARGETARCH}.deb \ + https://github.com/paperless-ngx/builder/releases/download/ghostscript-${GS_VERSION}/libgs10-common_${GS_VERSION}.dfsg-1_all.deb \ + https://github.com/paperless-ngx/builder/releases/download/jbig2enc-${JBIG2ENC_VERSION}/jbig2enc_${JBIG2ENC_VERSION}-1_${TARGETARCH}.deb \ + && echo "Installing qpdf ${QPDF_VERSION}" \ + && dpkg --install ./libqpdf29_${QPDF_VERSION}-1_${TARGETARCH}.deb \ + && dpkg --install ./qpdf_${QPDF_VERSION}-1_${TARGETARCH}.deb \ + && echo "Installing Ghostscript ${GS_VERSION}" \ + && dpkg --install ./libgs10-common_${GS_VERSION}.dfsg-1_all.deb \ + && dpkg --install ./libgs10_${GS_VERSION}.dfsg-1_${TARGETARCH}.deb \ + && dpkg --install ./ghostscript_${GS_VERSION}.dfsg-1_${TARGETARCH}.deb \ + && echo "Installing jbig2enc" \ + && dpkg --install ./jbig2enc_${JBIG2ENC_VERSION}-1_${TARGETARCH}.deb \ + && echo "Configuring imagemagick" \ + && cp /etc/ImageMagick-6/paperless-policy.xml /etc/ImageMagick-6/policy.xml \ + && echo "Cleaning up image layer" \ + && rm --force --verbose *.deb \ + && rm --recursive --force --verbose /var/lib/apt/lists/* + +WORKDIR /usr/src/paperless/src/ + +# Python dependencies +# Change pretty frequently +COPY --chown=1000:1000 ["pyproject.toml", "uv.lock", "/usr/src/paperless/src/"] + +# Packages needed only for building a few quick Python +# dependencies +ARG BUILD_PACKAGES="\ + build-essential \ + # https://github.com/PyMySQL/mysqlclient#linux + default-libmysqlclient-dev \ + pkg-config" + +# hadolint ignore=DL3042 +RUN --mount=type=cache,target=${UV_CACHE_DIR},id=python-cache \ + set -eux \ + && echo "Installing build system packages" \ + && apt-get update \ + && apt-get install --yes --quiet --no-install-recommends ${BUILD_PACKAGES} \ + && echo "Installing Python requirements" \ + && uv export --quiet --no-dev --all-extras --format requirements-txt --output-file requirements.txt \ + && uv pip install --system --no-python-downloads --python-preference system --requirements requirements.txt \ + && echo "Installing NLTK data" \ + && python3 -W ignore::RuntimeWarning -m nltk.downloader -d "/usr/share/nltk_data" snowball_data \ + && python3 -W ignore::RuntimeWarning -m nltk.downloader -d "/usr/share/nltk_data" stopwords \ + && python3 -W ignore::RuntimeWarning -m nltk.downloader -d "/usr/share/nltk_data" punkt_tab \ + && echo "Cleaning up image" \ + && apt-get --yes purge ${BUILD_PACKAGES} \ + && apt-get --yes autoremove --purge \ + && apt-get clean --yes \ + && rm --recursive --force --verbose *.whl \ + && rm --recursive --force --verbose /var/lib/apt/lists/* \ + && rm --recursive --force --verbose /tmp/* \ + && rm --recursive --force --verbose /var/tmp/* \ + && rm --recursive --force --verbose /var/cache/apt/archives/* \ + && truncate --size 0 /var/log/*log + +# copy backend +COPY --chown=1000:1000 ./src ./ + +# copy frontend +COPY --from=compile-frontend --chown=1000:1000 /src/src/documents/static/frontend/ ./documents/static/frontend/ + +# add users, setup scripts +# Mount the compiled frontend to expected location +RUN set -eux \ + && sed -i '1s|^#!/usr/bin/env python3|#!/command/with-contenv python3|' manage.py \ + && echo "Setting up user/group" \ + && addgroup --gid 1000 paperless \ + && useradd --uid 1000 --gid paperless --home-dir /usr/src/paperless paperless \ + && echo "Creating volume directories" \ + && mkdir --parents --verbose /usr/src/paperless/data \ + && mkdir --parents --verbose /usr/src/paperless/media \ + && mkdir --parents --verbose /usr/src/paperless/consume \ + && mkdir --parents --verbose /usr/src/paperless/export \ + && echo "Creating gnupg directory" \ + && mkdir -m700 --verbose /usr/src/paperless/.gnupg \ + && echo "Adjusting all permissions" \ + && chown --from root:root --changes --recursive paperless:paperless /usr/src/paperless \ + && echo "Collecting static files" \ + && s6-setuidgid paperless python3 manage.py collectstatic --clear --no-input --link \ + && s6-setuidgid paperless python3 manage.py compilemessages + +VOLUME ["/usr/src/paperless/data", \ + "/usr/src/paperless/media", \ + "/usr/src/paperless/consume", \ + "/usr/src/paperless/export"] + +ENTRYPOINT ["/init"] + +EXPOSE 8000 + +HEALTHCHECK --interval=30s --timeout=10s --retries=5 CMD [ "curl", "-fs", "-S", "-L", "--max-time", "2", "http://localhost:8000" ] diff --git a/docker/compose/docker-compose.ci-test.yml b/docker/compose/docker-compose.ci-test.yml deleted file mode 100644 index d5eb093..0000000 --- a/docker/compose/docker-compose.ci-test.yml +++ /dev/null @@ -1,25 +0,0 @@ -# Docker Compose file for running paperless testing with actual Gotenberg -# and Tika containers for a more end to end test of the Tika related functionality -# Can be used locally or by the CI to start the necessary containers with the -# correct networking for the tests -services: - gotenberg: - image: docker.io/gotenberg/gotenberg:8.23 - hostname: gotenberg - container_name: gotenberg - network_mode: host - restart: unless-stopped - # The gotenberg chromium route is used to convert .eml files. We do not - # want to allow external content like tracking pixels or even javascript. - command: - - "gotenberg" - - "--chromium-disable-javascript=true" - - "--chromium-allow-list=file:///tmp/.*" - - "--log-level=warn" - - "--log-format=text" - tika: - image: docker.io/apache/tika:latest - hostname: tika - container_name: tika - network_mode: host - restart: unless-stopped diff --git a/docker/compose/docker-compose.mariadb-tika.yml b/docker/compose/docker-compose.mariadb-tika.yml deleted file mode 100644 index fc1d4be..0000000 --- a/docker/compose/docker-compose.mariadb-tika.yml +++ /dev/null @@ -1,90 +0,0 @@ -# docker compose file for running paperless from the Docker Hub. -# This file contains everything paperless needs to run. -# Paperless supports amd64, arm and arm64 hardware. -# -# All compose files of paperless configure paperless in the following way: -# -# - Paperless is (re)started on system boot, if it was running before shutdown. -# - Docker volumes for storing data are managed by Docker. -# - Folders for importing and exporting files are created in the same directory -# as this file and mounted to the correct folders inside the container. -# - Paperless listens on port 8000. -# -# In addition to that, this Docker Compose file adds the following optional -# configurations: -# -# - Instead of SQLite (default), MariaDB is used as the database server. -# - Apache Tika and Gotenberg servers are started with paperless and paperless -# is configured to use these services. These provide support for consuming -# Office documents (Word, Excel, PowerPoint and their LibreOffice counter- -# parts). -# -# To install and update paperless with this file, do the following: -# -# - Copy this file as 'docker-compose.yml' and the files 'docker-compose.env' -# and '.env' into a folder. -# - Run 'docker compose pull'. -# - Run 'docker compose up -d'. -# -# For more extensive installation and update instructions, refer to the -# documentation. -services: - broker: - image: docker.io/library/redis:8 - restart: unless-stopped - volumes: - - redisdata:/data - db: - image: docker.io/library/mariadb:12 - restart: unless-stopped - volumes: - - dbdata:/var/lib/mysql - environment: - MARIADB_HOST: paperless - MARIADB_DATABASE: paperless - MARIADB_USER: paperless - MARIADB_PASSWORD: paperless - MARIADB_ROOT_PASSWORD: paperless - webserver: - image: ghcr.io/paperless-ngx/paperless-ngx:latest - restart: unless-stopped - depends_on: - - db - - broker - - gotenberg - - tika - ports: - - "8000:8000" - volumes: - - data:/usr/src/paperless/data - - media:/usr/src/paperless/media - - ./export:/usr/src/paperless/export - - ./consume:/usr/src/paperless/consume - env_file: docker-compose.env - environment: - PAPERLESS_REDIS: redis://broker:6379 - PAPERLESS_DBENGINE: mariadb - PAPERLESS_DBHOST: db - PAPERLESS_DBUSER: paperless # only needed if non-default username - PAPERLESS_DBPASS: paperless # only needed if non-default password - PAPERLESS_DBPORT: 3306 - PAPERLESS_TIKA_ENABLED: 1 - PAPERLESS_TIKA_GOTENBERG_ENDPOINT: http://gotenberg:3000 - PAPERLESS_TIKA_ENDPOINT: http://tika:9998 - gotenberg: - image: docker.io/gotenberg/gotenberg:8.23 - restart: unless-stopped - # The gotenberg chromium route is used to convert .eml files. We do not - # want to allow external content like tracking pixels or even javascript. - command: - - "gotenberg" - - "--chromium-disable-javascript=true" - - "--chromium-allow-list=file:///tmp/.*" - tika: - image: docker.io/apache/tika:latest - restart: unless-stopped -volumes: - data: - media: - dbdata: - redisdata: diff --git a/docker/compose/docker-compose.mariadb.yml b/docker/compose/docker-compose.mariadb.yml deleted file mode 100644 index 2265703..0000000 --- a/docker/compose/docker-compose.mariadb.yml +++ /dev/null @@ -1,69 +0,0 @@ -# Docker Compose file for running paperless from the Docker Hub. -# This file contains everything paperless needs to run. -# Paperless supports amd64, arm and arm64 hardware. -# -# All compose files of paperless configure paperless in the following way: -# -# - Paperless is (re)started on system boot, if it was running before shutdown. -# - Docker volumes for storing data are managed by Docker. -# - Folders for importing and exporting files are created in the same directory -# as this file and mounted to the correct folders inside the container. -# - Paperless listens on port 8000. -# -# In addition to that, this Docker Compose file adds the following optional -# configurations: -# -# - Instead of SQLite (default), MariaDB is used as the database server. -# -# To install and update paperless with this file, do the following: -# -# - Copy this file as 'docker-compose.yml' and the files 'docker-compose.env' -# and '.env' into a folder. -# - Run 'docker compose pull'. -# - Run 'docker compose up -d'. -# -# For more extensive installation and update instructions, refer to the -# documentation. -services: - broker: - image: docker.io/library/redis:8 - restart: unless-stopped - volumes: - - redisdata:/data - db: - image: docker.io/library/mariadb:12 - restart: unless-stopped - volumes: - - dbdata:/var/lib/mysql - environment: - MARIADB_HOST: paperless - MARIADB_DATABASE: paperless - MARIADB_USER: paperless - MARIADB_PASSWORD: paperless - MARIADB_ROOT_PASSWORD: paperless - webserver: - image: ghcr.io/paperless-ngx/paperless-ngx:latest - restart: unless-stopped - depends_on: - - db - - broker - ports: - - "8000:8000" - volumes: - - data:/usr/src/paperless/data - - media:/usr/src/paperless/media - - ./export:/usr/src/paperless/export - - ./consume:/usr/src/paperless/consume - env_file: docker-compose.env - environment: - PAPERLESS_REDIS: redis://broker:6379 - PAPERLESS_DBENGINE: mariadb - PAPERLESS_DBHOST: db - PAPERLESS_DBUSER: paperless # only needed if non-default username - PAPERLESS_DBPASS: paperless # only needed if non-default password - PAPERLESS_DBPORT: 3306 -volumes: - data: - media: - dbdata: - redisdata: diff --git a/docker/compose/docker-compose.portainer.yml b/docker/compose/docker-compose.portainer.yml deleted file mode 100644 index 3dac3e7..0000000 --- a/docker/compose/docker-compose.portainer.yml +++ /dev/null @@ -1,65 +0,0 @@ -# Docker Compose file for running paperless from the Docker Hub. -# This file contains everything paperless needs to run. -# Paperless supports amd64, arm and arm64 hardware. -# -# All compose files of paperless configure paperless in the following way: -# -# - Paperless is (re)started on system boot, if it was running before shutdown. -# - Docker volumes for storing data are managed by Docker. -# - Folders for importing and exporting files are created in the same directory -# as this file and mounted to the correct folders inside the container. -# - Paperless listens on port 8010. -# -# In addition to that, this Docker Compose file adds the following optional -# configurations: -# -# - Instead of SQLite (default), PostgreSQL is used as the database server. -# -# To install and update paperless with this file, do the following: -# -# - Open portainer Stacks list and click 'Add stack' -# - Paste the contents of this file and assign a name, e.g. 'paperless' -# - Upload 'docker-compose.env' by clicking on 'Load variables from .env file' -# - Modify the environment variables as needed -# - Click 'Deploy the stack' and wait for it to be deployed -# -# For more extensive installation and update instructions, refer to the -# documentation. -services: - broker: - image: docker.io/library/redis:8 - restart: unless-stopped - volumes: - - redisdata:/data - db: - image: docker.io/library/postgres:18 - restart: unless-stopped - volumes: - - pgdata:/var/lib/postgresql/data - environment: - POSTGRES_DB: paperless - POSTGRES_USER: paperless - POSTGRES_PASSWORD: paperless - webserver: - image: ghcr.io/paperless-ngx/paperless-ngx:latest - restart: unless-stopped - depends_on: - - db - - broker - ports: - - "8010:8000" - volumes: - - data:/usr/src/paperless/data - - media:/usr/src/paperless/media - - ./export:/usr/src/paperless/export - - ./consume:/usr/src/paperless/consume - environment: - PAPERLESS_REDIS: redis://broker:6379 - PAPERLESS_DBHOST: db - env_file: - - stack.env -volumes: - data: - media: - pgdata: - redisdata: diff --git a/docker/compose/docker-compose.postgres-tika.yml b/docker/compose/docker-compose.postgres-tika.yml deleted file mode 100644 index c50a39e..0000000 --- a/docker/compose/docker-compose.postgres-tika.yml +++ /dev/null @@ -1,84 +0,0 @@ -# Docker Compose file for running paperless from the docker container registry. -# This file contains everything paperless needs to run. -# Paperless supports amd64, arm and arm64 hardware. -# -# All compose files of paperless configure paperless in the following way: -# -# - Paperless is (re)started on system boot, if it was running before shutdown. -# - Docker volumes for storing data are managed by Docker. -# - Folders for importing and exporting files are created in the same directory -# as this file and mounted to the correct folders inside the container. -# - Paperless listens on port 8000. -# -# In addition to that, this Docker Compose file adds the following optional -# configurations: -# -# - Instead of SQLite (default), PostgreSQL is used as the database server. -# - Apache Tika and Gotenberg servers are started with paperless and paperless -# is configured to use these services. These provide support for consuming -# Office documents (Word, Excel, PowerPoint and their LibreOffice counter- -# parts). -# -# To install and update paperless with this file, do the following: -# -# - Copy this file as 'docker-compose.yml' and the files 'docker-compose.env' -# and '.env' into a folder. -# - Run 'docker compose pull'. -# - Run 'docker compose up -d'. -# -# For more extensive installation and update instructions, refer to the -# documentation. -services: - broker: - image: docker.io/library/redis:8 - restart: unless-stopped - volumes: - - redisdata:/data - db: - image: docker.io/library/postgres:18 - restart: unless-stopped - volumes: - - pgdata:/var/lib/postgresql/data - environment: - POSTGRES_DB: paperless - POSTGRES_USER: paperless - POSTGRES_PASSWORD: paperless - webserver: - image: ghcr.io/paperless-ngx/paperless-ngx:latest - restart: unless-stopped - depends_on: - - db - - broker - - gotenberg - - tika - ports: - - "8000:8000" - volumes: - - data:/usr/src/paperless/data - - media:/usr/src/paperless/media - - ./export:/usr/src/paperless/export - - ./consume:/usr/src/paperless/consume - env_file: docker-compose.env - environment: - PAPERLESS_REDIS: redis://broker:6379 - PAPERLESS_DBHOST: db - PAPERLESS_TIKA_ENABLED: 1 - PAPERLESS_TIKA_GOTENBERG_ENDPOINT: http://gotenberg:3000 - PAPERLESS_TIKA_ENDPOINT: http://tika:9998 - gotenberg: - image: docker.io/gotenberg/gotenberg:8.23 - restart: unless-stopped - # The gotenberg chromium route is used to convert .eml files. We do not - # want to allow external content like tracking pixels or even javascript. - command: - - "gotenberg" - - "--chromium-disable-javascript=true" - - "--chromium-allow-list=file:///tmp/.*" - tika: - image: docker.io/apache/tika:latest - restart: unless-stopped -volumes: - data: - media: - pgdata: - redisdata: diff --git a/docker/compose/docker-compose.sqlite-tika.yml b/docker/compose/docker-compose.sqlite-tika.yml deleted file mode 100644 index 130b267..0000000 --- a/docker/compose/docker-compose.sqlite-tika.yml +++ /dev/null @@ -1,72 +0,0 @@ -# Docker Compose file for running paperless from the docker container registry. -# This file contains everything paperless needs to run. -# Paperless supports amd64, arm and arm64 hardware. -# All compose files of paperless configure paperless in the following way: -# -# - Paperless is (re)started on system boot, if it was running before shutdown. -# - Docker volumes for storing data are managed by Docker. -# - Folders for importing and exporting files are created in the same directory -# as this file and mounted to the correct folders inside the container. -# - Paperless listens on port 8000. -# -# SQLite is used as the database. The SQLite file is stored in the data volume. -# -# In addition to that, this Docker Compose file adds the following optional -# configurations: -# -# - Apache Tika and Gotenberg servers are started with paperless and paperless -# is configured to use these services. These provide support for consuming -# Office documents (Word, Excel, PowerPoint and their LibreOffice counter- -# parts). -# -# To install and update paperless with this file, do the following: -# -# - Copy this file as 'docker-compose.yml' and the files 'docker-compose.env' -# and '.env' into a folder. -# - Run 'docker compose pull'. -# - Run 'docker compose up -d'. -# -# For more extensive installation and update instructions, refer to the -# documentation. -services: - broker: - image: docker.io/library/redis:8 - restart: unless-stopped - volumes: - - redisdata:/data - webserver: - image: ghcr.io/paperless-ngx/paperless-ngx:latest - restart: unless-stopped - depends_on: - - broker - - gotenberg - - tika - ports: - - "8000:8000" - volumes: - - data:/usr/src/paperless/data - - media:/usr/src/paperless/media - - ./export:/usr/src/paperless/export - - ./consume:/usr/src/paperless/consume - env_file: docker-compose.env - environment: - PAPERLESS_REDIS: redis://broker:6379 - PAPERLESS_TIKA_ENABLED: 1 - PAPERLESS_TIKA_GOTENBERG_ENDPOINT: http://gotenberg:3000 - PAPERLESS_TIKA_ENDPOINT: http://tika:9998 - gotenberg: - image: docker.io/gotenberg/gotenberg:8.23 - restart: unless-stopped - # The gotenberg chromium route is used to convert .eml files. We do not - # want to allow external content like tracking pixels or even javascript. - command: - - "gotenberg" - - "--chromium-disable-javascript=true" - - "--chromium-allow-list=file:///tmp/.*" - tika: - image: docker.io/apache/tika:latest - restart: unless-stopped -volumes: - data: - media: - redisdata: diff --git a/docker/compose/docker-compose.sqlite.yml b/docker/compose/docker-compose.sqlite.yml deleted file mode 100644 index 362fbc9..0000000 --- a/docker/compose/docker-compose.sqlite.yml +++ /dev/null @@ -1,48 +0,0 @@ -# Docker Compose file for running paperless from the Docker Hub. -# This file contains everything paperless needs to run. -# Paperless supports amd64, arm and arm64 hardware. -# -# All compose files of paperless configure paperless in the following way: -# -# - Paperless is (re)started on system boot, if it was running before shutdown. -# - Docker volumes for storing data are managed by Docker. -# - Folders for importing and exporting files are created in the same directory -# as this file and mounted to the correct folders inside the container. -# - Paperless listens on port 8000. -# -# SQLite is used as the database. The SQLite file is stored in the data volume. -# -# To install and update paperless with this file, do the following: -# -# - Copy this file as 'docker-compose.yml' and the files 'docker-compose.env' -# and '.env' into a folder. -# - Run 'docker compose pull'. -# - Run 'docker compose up -d'. -# -# For more extensive installation and update instructions, refer to the -# documentation. -services: - broker: - image: docker.io/library/redis:8 - restart: unless-stopped - volumes: - - redisdata:/data - webserver: - image: ghcr.io/paperless-ngx/paperless-ngx:latest - restart: unless-stopped - depends_on: - - broker - ports: - - "8000:8000" - volumes: - - data:/usr/src/paperless/data - - media:/usr/src/paperless/media - - ./export:/usr/src/paperless/export - - ./consume:/usr/src/paperless/consume - env_file: docker-compose.env - environment: - PAPERLESS_REDIS: redis://broker:6379 -volumes: - data: - media: - redisdata: diff --git a/docker/compose/docker-compose.postgres.yml b/docker/compose/docker-compose.yml similarity index 83% rename from docker/compose/docker-compose.postgres.yml rename to docker/compose/docker-compose.yml index 77b8626..77da4e4 100644 --- a/docker/compose/docker-compose.postgres.yml +++ b/docker/compose/docker-compose.yml @@ -34,19 +34,28 @@ services: image: docker.io/library/postgres:18 restart: unless-stopped volumes: - - pgdata:/var/lib/postgresql/data + - pgdata:/var/lib/postgresql environment: POSTGRES_DB: paperless POSTGRES_USER: paperless POSTGRES_PASSWORD: paperless + healthcheck: + test: ["CMD-SHELL", "pg_isready -U paperless"] + interval: 5s + timeout: 5s + retries: 5 webserver: - image: ghcr.io/paperless-ngx/paperless-ngx:latest + build: + context: ../.. + dockerfile: docker/compose/Dockerfile restart: unless-stopped depends_on: - - db - - broker + db: + condition: service_healthy + broker: + condition: service_started ports: - - "8000:8000" + - "8010:8000" volumes: - data:/usr/src/paperless/data - media:/usr/src/paperless/media