Skip modify of user/group when PUID/GUID not changed #1541

Closed
rocktop wants to merge 2 commits from rocktop/api:no_root into main
3 changed files with 18 additions and 3 deletions

View File

@ -35,8 +35,8 @@ ENV PUID 1000
ENV PGID 1000
RUN apk --update --no-cache add tzdata tini shadow && \
addgroup vikunja && \
adduser -s /bin/sh -D -G vikunja vikunja -h /app/vikunja -H
addgroup vikunja --gid "$PGID" && \
adduser -s /bin/sh -D -G vikunja vikunja --uid "$PUID" -h /app/vikunja -H
COPY docker/entrypoint.sh /entrypoint.sh
RUN chmod 0755 /entrypoint.sh && mkdir files

View File

@ -2,7 +2,8 @@
set -e
if [ -n "$PUID" ] && [ "$PUID" -ne 0 ] && \
[ -n "$PGID" ] && [ "$PGID" -ne 0 ] ; then
[ -n "$PGID" ] && [ "$PGID" -ne 0 ] && \
([ "$PUID" -ne "$(id -u vikunja)" ] || [ "$PGID" -ne "$(id -g vikunja)" ]) ; then
echo "info: creating the new user vikunja with $PUID:$PGID"
groupmod -g "$PGID" -o vikunja
usermod -u "$PUID" -o vikunja

View File

@ -107,6 +107,20 @@ This is a simple proxy configuration which will forward all requests to `/api/`
<b>NOTE:</b> Even if you want to make your installation available under a different port, you don't need to change anything in this configuration.
</div>
<div class="notification is-info">
<b>NOTE:</b> The API image supports running as the non-root user vikunja as long as PUID/PGUID are static. A modification to docker-compose is required.
Review
Nice! Can you add the same note to these two other places as well? https://kolaente.dev/vikunja/api/src/branch/main/docs/content/doc/setup/install-backend.md and https://kolaente.dev/vikunja/api/src/branch/main/docs/content/doc/setup/full-docker-example.md
</div>
{{< highlight yaml >}}
version: '3'
services:
api:
image: vikunja/api
user: vikunja <--- add this
{{< /highlight >}}
<div class="notification is-warning">
<b>NOTE:</b> If you change the max upload size in Vikunja's settings, you'll need to also change the <code>client_max_body_size</code> in the nginx proxy config.
</div>