summaryrefslogtreecommitdiff
path: root/gemfeed/examples/conf/f3s/anki-sync-server/docker-image/entrypoint.sh
diff options
context:
space:
mode:
Diffstat (limited to 'gemfeed/examples/conf/f3s/anki-sync-server/docker-image/entrypoint.sh')
-rw-r--r--gemfeed/examples/conf/f3s/anki-sync-server/docker-image/entrypoint.sh31
1 files changed, 31 insertions, 0 deletions
diff --git a/gemfeed/examples/conf/f3s/anki-sync-server/docker-image/entrypoint.sh b/gemfeed/examples/conf/f3s/anki-sync-server/docker-image/entrypoint.sh
new file mode 100644
index 00000000..9a72cca3
--- /dev/null
+++ b/gemfeed/examples/conf/f3s/anki-sync-server/docker-image/entrypoint.sh
@@ -0,0 +1,31 @@
+#!/bin/sh
+set -o errexit
+set -o nounset
+set -o pipefail
+
+# Default PUID and PGID if not provided
+export PUID=${PUID:-1000}
+export PGID=${PGID:-1000}
+
+# These values are fixed and cannot be overwritten from the outside for
+# convenience and safety reasons
+export SYNC_PORT=8080
+export SYNC_BASE=/anki_data
+
+# Check if group exists, create if not
+if ! getent group anki-group > /dev/null 2>&1; then
+ addgroup -g "$PGID" anki-group
+fi
+
+# Check if user exists, create if not
+if ! id -u anki > /dev/null 2>&1; then
+ adduser -D -H -u "$PUID" -G anki-group anki
+fi
+
+# Fix ownership of mounted volumes
+mkdir -p /anki_data
+#chown anki:anki-group /anki_data
+
+# Run the provided command as the `anki` user
+exec su-exec anki "$@"
+