feat(docker): simplify docker compose for end users (#96)

* feat(docker): simplify docker compose for end users

The previous docker-compose requires end user to manually handle
permissions of taskchampion data dir. And this commit has directories
automatically set up in docker-entrypoint.sh, just like what
postgresql did in https://github.com/docker-library/postgres/blob/master/docker-entrypoint.sh

* fix(docker): revert to anonymous data volume for compatibility

* feat: use uid 1092 for taskchampion

* fix(docker): revert mkdir

This is embarrassing that subpaths are not automatically created.

So we still need mkdir service in case of anonymous data volume.

* fix(docker): typo
This commit is contained in:
adamanteye 2025-03-02 02:08:27 +08:00 committed by GitHub
parent c47612b3a0
commit 65ad035d8d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 42 additions and 19 deletions

13
docker-entrypoint.sh Executable file
View file

@ -0,0 +1,13 @@
#!/bin/sh
set -e
echo "starting entrypoint script..."
if [ "$1" = "/bin/taskchampion-sync-server" ]; then
echo "setting data directories"
mkdir -p "/var/lib/taskchampion-sync-server/data"
chown -R 1092:1092 "/var/lib/taskchampion-sync-server/data"
chmod -R 700 "/var/lib/taskchampion-sync-server/data"
if [ "$(id -u)" = "0" ]; then
echo "switching to user 'taskchampion'"
exec su-exec taskchampion "$@"
fi
fi