Skip to content

A community-supported supercharged document management system: scan, index and archive all your documents

move supervisord call into wrapper script

Aidan Steincdecf8904e12
diff --git a/Dockerfile b/Dockerfile
index 7f0d1adb0..981a194c9 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -125,6 +125,7 @@ COPY [ \
"docker/supervisord.conf", \
"docker/docker-entrypoint.sh", \
"docker/docker-prepare.sh", \
+ "docker/paperless_cmd.sh", \
"docker/wait-for-redis.py", \
"docker/management_script.sh", \
"docker/install_management_commands.sh", \
@@ -144,6 +145,8 @@ RUN set -eux \
&& chmod 755 /sbin/docker-prepare.sh \
&& mv wait-for-redis.py /sbin/wait-for-redis.py \
&& chmod 755 /sbin/wait-for-redis.py \
+ && mv paperless_cmd.sh /usr/local/bin/paperless_cmd.sh \
+ && chmod 755 /usr/local/bin/paperless_cmd.sh \
&& echo "Installing managment commands" \
&& chmod +x install_management_commands.sh \
&& ./install_management_commands.sh
@@ -222,4 +225,4 @@ ENTRYPOINT ["/sbin/docker-entrypoint.sh"]
EXPOSE 8000
-CMD ["/usr/local/bin/supervisord", "-c", "/etc/supervisord.conf"]
+CMD ["/usr/local/bin/paperless_cmd.sh"]
diff --git a/docker/paperless_cmd.sh b/docker/paperless_cmd.sh
new file mode 100755
index 000000000..2c8c1364a
--- /dev/null
+++ b/docker/paperless_cmd.sh
@@ -0,0 +1,15 @@
+#!/usr/bin/env bash
+
+rootless_args=()
+if [ $(id -u) == $(id -u paperless) ]; then
+ rootless_args=(
+ --user
+ paperless
+ --logfile
+ supervisord.log
+ --pidfile
+ supervisord.pid
+ )
+fi
+
+/usr/local/bin/supervisord -c /etc/supervisord.conf ${rootless_args[@]}
diff --git a/docs/setup.rst b/docs/setup.rst
index 10301d29d..60fbc212e 100644
--- a/docs/setup.rst
+++ b/docs/setup.rst
@@ -186,8 +186,8 @@ Install Paperless from Docker Hub
**Rootless**
- If you want to run Paperless as a rootless container, you will need to add the
- following to your ``docker-compose.yml``:
+ If you want to run Paperless as a rootless container, you will need to do the
+ following in your ``docker-compose.yml``:
- set the ``user`` running the container to map to the ``paperless`` user in the
container.
@@ -195,26 +195,13 @@ Install Paperless from Docker Hub
``USERMAP_GID`` are set to in the next step.
See ``USERMAP_UID`` and ``USERMAP_GID`` :ref:`here <configuration-docker>`.
- - override some of the ``supervisord`` defaults by setting the docker ``command``
- (`see here <https://docs.docker.com/compose/compose-file/#command>`_) to:
-
- Your ``docker-compose.yml`` entry for Paperless will look something like:
+ Your entry for Paperless should contain something like:
.. code::
webserver:
image: ghcr.io/paperless-ngx/paperless-ngx:latest
user: <user_id>
- command:
- - "/usr/local/bin/supervisord"
- - "-c"
- - "/etc/supervisord.conf"
- - "--user"
- - "paperless"
- - "--logfile"
- - "supervisord.log"
- - "--pidfile"
- - "supervisord.pid"
5. Modify ``docker-compose.env``, following the comments in the file. The
most important change is to set ``USERMAP_UID`` and ``USERMAP_GID``