Skip to content

Commit cdecf89

Browse files
author
Aidan Stein
committed
move supervisord call into wrapper script
1 parent 3d16266 commit cdecf89

File tree

3 files changed

+22
-17
lines changed

3 files changed

+22
-17
lines changed

Dockerfile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ COPY [ \
125125
"docker/supervisord.conf", \
126126
"docker/docker-entrypoint.sh", \
127127
"docker/docker-prepare.sh", \
128+
"docker/paperless_cmd.sh", \
128129
"docker/wait-for-redis.py", \
129130
"docker/management_script.sh", \
130131
"docker/install_management_commands.sh", \
@@ -144,6 +145,8 @@ RUN set -eux \
144145
&& chmod 755 /sbin/docker-prepare.sh \
145146
&& mv wait-for-redis.py /sbin/wait-for-redis.py \
146147
&& chmod 755 /sbin/wait-for-redis.py \
148+
&& mv paperless_cmd.sh /usr/local/bin/paperless_cmd.sh \
149+
&& chmod 755 /usr/local/bin/paperless_cmd.sh \
147150
&& echo "Installing managment commands" \
148151
&& chmod +x install_management_commands.sh \
149152
&& ./install_management_commands.sh
@@ -222,4 +225,4 @@ ENTRYPOINT ["/sbin/docker-entrypoint.sh"]
222225

223226
EXPOSE 8000
224227

225-
CMD ["/usr/local/bin/supervisord", "-c", "/etc/supervisord.conf"]
228+
CMD ["/usr/local/bin/paperless_cmd.sh"]

docker/paperless_cmd.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/usr/bin/env bash
2+
3+
rootless_args=()
4+
if [ $(id -u) == $(id -u paperless) ]; then
5+
rootless_args=(
6+
--user
7+
paperless
8+
--logfile
9+
supervisord.log
10+
--pidfile
11+
supervisord.pid
12+
)
13+
fi
14+
15+
/usr/local/bin/supervisord -c /etc/supervisord.conf ${rootless_args[@]}

docs/setup.rst

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -186,35 +186,22 @@ Install Paperless from Docker Hub
186186

187187
**Rootless**
188188

189-
If you want to run Paperless as a rootless container, you will need to add the
190-
following to your ``docker-compose.yml``:
189+
If you want to run Paperless as a rootless container, you will need to do the
190+
following in your ``docker-compose.yml``:
191191

192192
- set the ``user`` running the container to map to the ``paperless`` user in the
193193
container.
194194
This value (``user_id`` below), should be the same id that ``USERMAP_UID`` and
195195
``USERMAP_GID`` are set to in the next step.
196196
See ``USERMAP_UID`` and ``USERMAP_GID`` :ref:`here <configuration-docker>`.
197197

198-
- override some of the ``supervisord`` defaults by setting the docker ``command``
199-
(`see here <https://docs.docker.com/compose/compose-file/#command>`_) to:
200-
201-
Your ``docker-compose.yml`` entry for Paperless will look something like:
198+
Your entry for Paperless should contain something like:
202199

203200
.. code::
204201
205202
webserver:
206203
image: ghcr.io/paperless-ngx/paperless-ngx:latest
207204
user: <user_id>
208-
command:
209-
- "/usr/local/bin/supervisord"
210-
- "-c"
211-
- "/etc/supervisord.conf"
212-
- "--user"
213-
- "paperless"
214-
- "--logfile"
215-
- "supervisord.log"
216-
- "--pidfile"
217-
- "supervisord.pid"
218205
219206
5. Modify ``docker-compose.env``, following the comments in the file. The
220207
most important change is to set ``USERMAP_UID`` and ``USERMAP_GID``

0 commit comments

Comments
 (0)