From a08cda96ce98486de460d49e443f997ed0679949 Mon Sep 17 00:00:00 2001 From: bp99 Date: Fri, 2 Jan 2026 14:42:07 +0100 Subject: [PATCH] allow running with custom PUID and PGID --- entrypoint-postgres.sh | 11 ++++++----- entrypoint-sqlite.sh | 11 ++++++----- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/entrypoint-postgres.sh b/entrypoint-postgres.sh index b28e9c2..74728d5 100755 --- a/entrypoint-postgres.sh +++ b/entrypoint-postgres.sh @@ -2,11 +2,14 @@ set -e echo "starting entrypoint script..." if [ "$1" = "/bin/taskchampion-sync-server-postgres" ]; then + : ${PUID:-1092} + : ${PGID:-1092} + : ${DATA_DIR:=/var/lib/taskchampion-sync-server/data} export DATA_DIR echo "setting up data directory ${DATA_DIR}" mkdir -p "${DATA_DIR}" - chown -R taskchampion:users "${DATA_DIR}" + chown -R "${PUID}:${PGID}" "${DATA_DIR}" chmod -R 700 "${DATA_DIR}" : ${LISTEN:=0.0.0.0:8080} @@ -20,10 +23,8 @@ if [ "$1" = "/bin/taskchampion-sync-server-postgres" ]; then unset CLIENT_ID fi - if [ "$(id -u)" = "0" ]; then - echo "Running server as user 'taskchampion'" - exec su-exec taskchampion "$@" - fi + echo "Running server as user ${PUID} (group ${PGID})" + exec su-exec "${PUID}":"${PGID}" "$@" else eval "${@}" fi diff --git a/entrypoint-sqlite.sh b/entrypoint-sqlite.sh index 1bbbfc0..357974d 100755 --- a/entrypoint-sqlite.sh +++ b/entrypoint-sqlite.sh @@ -2,11 +2,14 @@ set -e echo "starting entrypoint script..." if [ "$1" = "/bin/taskchampion-sync-server" ]; then + : ${PUID:-1092} + : ${PGID:-1092} + : ${DATA_DIR:=/var/lib/taskchampion-sync-server/data} export DATA_DIR echo "setting up data directory ${DATA_DIR}" mkdir -p "${DATA_DIR}" - chown -R taskchampion:users "${DATA_DIR}" + chown -R ${PUID}:${PGID} "${DATA_DIR}" chmod -R 700 "${DATA_DIR}" : ${LISTEN:=0.0.0.0:8080} @@ -20,10 +23,8 @@ if [ "$1" = "/bin/taskchampion-sync-server" ]; then unset CLIENT_ID fi - if [ "$(id -u)" = "0" ]; then - echo "Running server as user 'taskchampion'" - exec su-exec taskchampion "$@" - fi + echo "Running server as user ${PUID} (group ${PGID})" + exec su-exec "${PUID}":"${PGID}" "$@" else eval "${@}" fi